question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mapping adding order matters for multiple mappings?

See original GitHub issue

hi,

I have a weird behavior for these 2 mappings that I’m adding.

I’m sending the following request:

body:

<xml>555</xml>

headers:

SOAPAction ->http://tempuri.org/IService/DecryptByKeyType
Content-Type -> text/xml

I’m creating 2 mappings (dont mind the mapping guids):

{
    "Guid": "2453d1d1-d64f-4f7b-b0bd-e58aa0451094",
    "Priority": 1,
    "Request": {
      "Methods": [
        "POST"
      ],
      "Headers": [
        {
          "Name": "Content-Type",
          "Matchers": [
            {
              "Name": "WildcardMatcher",
              "Pattern": "text/xml",
              "IgnoreCase": true
            },
            {
              "Name": "WildcardMatcher",
              "Pattern": "\"text/xml\"",
              "IgnoreCase": true
            }
          ]
        },
        {
          "Name": "SOAPAction",
          "Matchers": [
            {
              "Name": "WildcardMatcher",
              "Pattern": "http://tempuri.org/IService/DecryptByKeyType",
              "IgnoreCase": true
            },
            {
              "Name": "WildcardMatcher",
              "Pattern": "\"http://tempuri.org/IService/DecryptByKeyType\"",
              "IgnoreCase": true
            }
          ]
        }
      ]
    },
    "Response": {
      "StatusCode": 200,
      "BodyDestination": "SameAsSource",
      "Body": "<a:DecryptedValue>5678</a:DecryptedValue>",
      "Headers": {
        "Content-Type": "text/xml"
      }
    }
  },
  {
    "Guid": "69223327-5d5a-471a-abbe-9089d1f9ec28",
    "Priority": 1,
    "Request": {
      "Methods": [
        "POST"
      ],
      "Headers": [
        {
          "Name": "Content-Type",
          "Matchers": [
            {
              "Name": "WildcardMatcher",
              "Pattern": "text/xml",
              "IgnoreCase": true
            },
            {
              "Name": "WildcardMatcher",
              "Pattern": "\"text/xml\"",
              "IgnoreCase": true
            }
          ]
        },
        {
          "Name": "SOAPAction",
          "Matchers": [
            {
              "Name": "WildcardMatcher",
              "Pattern": "http://tempuri.org/IService/DecryptByKeyType",
              "IgnoreCase": true
            },
            {
              "Name": "WildcardMatcher",
              "Pattern": "\"http://tempuri.org/IService/DecryptByKeyType\"",
              "IgnoreCase": true
            }
          ]
        }
      ],
      "Body": {
        "Matcher": {
          "Name": "RegexMatcher",
          "Pattern": "^.*555.*$",
          "IgnoreCase": false
        }
      }
    },
    "Response": {
      "StatusCode": 200,
      "BodyDestination": "SameAsSource",
      "Body": "<a:DecryptedValue>1234</a:DecryptedValue>",
      "Headers": {
        "Content-Type": "text/xml"
      }
    }
  }

The thing that it seems that if I add the first mapping first then its get caught and the other way around then the 2nd mapping gets caught:

example of the admin/requests when first mapping added first:

{
    "Guid": "12b0e84c-ce26-4eb7-86b5-ffc2e3dade21",
    "Request": {
      "ClientIP": "127.0.0.1",
      "DateTime": "2019-09-15T18:42:41.7264408Z",
      "Path": "/",
      "AbsolutePath": "/",
      "Url": "http://localhost:5566/",
      "AbsoluteUrl": "http://localhost:5566/",
      "Query": {},
      "Method": "POST",
      "Headers": {
        "Cache-Control": [
          "no-cache"
        ],
        "Connection": [
          "keep-alive"
        ],
        "Content-Type": [
          "text/xml"
        ],
        "Accept": [
          "*/*"
        ],
        "Accept-Encoding": [
          "gzip, deflate"
        ],
        "Cookie": [
          "sails.sid=s%3AwwZNPsU03ioQg2VhyQAtk5c5BB1j3FmB.hhaxvwUjdQErRAhH14WkmlSNgD7A8pEKxmBu9NeMeNc"
        ],
        "Host": [
          "localhost:5566"
        ],
        "User-Agent": [
          "PostmanRuntime/7.15.2"
        ],
        "Content-Length": [
          "24"
        ],
        "SOAPAction": [
          "http://tempuri.org/IService/DecryptByKeyType"
        ],
        "Postman-Token": [
          "d8363d3a-8510-4e6d-98ad-0ac0e2f71193"
        ]
      },
      "Cookies": {
        "sails.sid": "s:wwZNPsU03ioQg2VhyQAtk5c5BB1j3FmB.hhaxvwUjdQErRAhH14WkmlSNgD7A8pEKxmBu9NeMeNc"
      },
      "Body": "<xml>555</xml>",
      "BodyEncoding": {
        "CodePage": 65001,
        "EncodingName": "Unicode (UTF-8)",
        "WebName": "utf-8"
      },
      "DetectedBodyType": "String",
      "DetectedBodyTypeFromContentType": "String"
    },
    "Response": {
      "StatusCode": 200,
      "Headers": {
        "Content-Type": [
          "text/xml"
        ]
      },
      "BodyDestination": "SameAsSource",
      "Body": "<a:DecryptedValue>5678</a:DecryptedValue>",
      "BodyEncoding": {
        "CodePage": 65001,
        "EncodingName": "Unicode (UTF-8)",
        "WebName": "utf-8"
      },
      "DetectedBodyType": 1,
      "DetectedBodyTypeFromContentType": 0
    },
    "MappingGuid": "877d3ff6-d749-495b-8f41-1c1b078ae834",
    "RequestMatchResult": {
      "TotalScore": 4.0,
      "TotalNumber": 4,
      "IsPerfectMatch": true,
      "AverageTotalScore": 1.0,
      "MatchDetails": [
        {
          "Name": "MethodMatcher",
          "Score": 1.0
        },
        {
          "Name": "BodyMatcher",
          "Score": 1.0
        },
        {
          "Name": "HeaderMatcher",
          "Score": 1.0
        },
        {
          "Name": "HeaderMatcher",
          "Score": 1.0
        }
      ]
    }

example of the admin/requests when second mapping added first:

{
    "Guid": "8438ae3b-fa78-4754-85eb-62cb888ecb22",
    "Request": {
      "ClientIP": "127.0.0.1",
      "DateTime": "2019-09-15T18:43:56.0778042Z",
      "Path": "/",
      "AbsolutePath": "/",
      "Url": "http://localhost:5566/",
      "AbsoluteUrl": "http://localhost:5566/",
      "Query": {},
      "Method": "POST",
      "Headers": {
        "Cache-Control": [
          "no-cache"
        ],
        "Connection": [
          "keep-alive"
        ],
        "Content-Type": [
          "text/xml"
        ],
        "Accept": [
          "*/*"
        ],
        "Accept-Encoding": [
          "gzip, deflate"
        ],
        "Cookie": [
          "sails.sid=s%3AwwZNPsU03ioQg2VhyQAtk5c5BB1j3FmB.hhaxvwUjdQErRAhH14WkmlSNgD7A8pEKxmBu9NeMeNc"
        ],
        "Host": [
          "localhost:5566"
        ],
        "User-Agent": [
          "PostmanRuntime/7.15.2"
        ],
        "Content-Length": [
          "24"
        ],
        "SOAPAction": [
          "http://tempuri.org/IService/DecryptByKeyType"
        ],
        "Postman-Token": [
          "8195e66a-98df-48ad-9e34-4a111717394a"
        ]
      },
      "Cookies": {
        "sails.sid": "s:wwZNPsU03ioQg2VhyQAtk5c5BB1j3FmB.hhaxvwUjdQErRAhH14WkmlSNgD7A8pEKxmBu9NeMeNc"
      },
      "Body": "<xml>555</xml>",
      "BodyEncoding": {
        "CodePage": 65001,
        "EncodingName": "Unicode (UTF-8)",
        "WebName": "utf-8"
      },
      "DetectedBodyType": "String",
      "DetectedBodyTypeFromContentType": "String"
    },
    "Response": {
      "StatusCode": 200,
      "Headers": {
        "Content-Type": [
          "text/xml"
        ]
      },
      "BodyDestination": "SameAsSource",
      "Body": "<a:DecryptedValue>1234</a:DecryptedValue>",
      "BodyEncoding": {
        "CodePage": 65001,
        "EncodingName": "Unicode (UTF-8)",
        "WebName": "utf-8"
      },
      "DetectedBodyType": 1,
      "DetectedBodyTypeFromContentType": 0
    },
    "MappingGuid": "2453d1d1-d64f-4f7b-b0bd-e58aa0451094",
    "RequestMatchResult": {
      "TotalScore": 3.0,
      "TotalNumber": 3,
      "IsPerfectMatch": true,
      "AverageTotalScore": 1.0,
      "MatchDetails": [
        {
          "Name": "MethodMatcher",
          "Score": 1.0
        },
        {
          "Name": "HeaderMatcher",
          "Score": 1.0
        },
        {
          "Name": "HeaderMatcher",
          "Score": 1.0
        }
      ]
    }
  }

Can you please check if I’m missing anything?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
StefHcommented, Sep 17, 2019

No ETA, yet.

Please keep a watch on this project + Nuget.

0reactions
gregokscommented, Sep 17, 2019

I’ve tested and its working in WireMock.Net.1.0.30-ci-11883 version. Thanks!!

Do you have an ETA for version that will include all of the current open bug fixes?

Thanks,

Greg

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Between Mappings
When processing the source values for transformations, multiple mappings may apply to a specific source value. The order of precedence is Explicit, Between, ......
Read more >
Mapping with Non-deterministic Ordering of Query ...
To handle both URLs where the ordering changes, I have to create a new mapping for each combination of parameters. This is problematic...
Read more >
java - Adding Maps to a List results in adding the same ...
This way you can store multiple values for each header (the header is still the key of the map). The order of values...
Read more >
Mapping Objects to Relational Databases: O/R ...
Whenever a key column is mapped to a property of a class, such as the mapping between OrderItem.ItemSequence and Order.orderItems.position(orderItem), this is ...
Read more >
How To Create a Custom Google Maps With Multiple Markers
Not: With Atlist you can embed your map on any website: Squarespace, Wix, Wordpress, Weebly, Webflow— doesn't matter.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found