Header matching issues #469

Closed
opened 2025-12-29 15:24:37 +01:00 by adam · 1 comment
Owner

Originally created by @stopdropandrew on GitHub (Nov 24, 2022).

Describe the bug

Header matchers seem to be ignored.

I'm using docker and I've got three json mappings. They each have the same path and method matchers and each have a unique header matcher. The header matching seems to not work.

Test to reproduce

mappings:

{
    ...
    "Headers": [
      {
        "Accept": {
          "Matcher": "ExactMatcher",
          "Pattern": "application/json"
        }
      },
      {
        "my-custom-header": {
          "Matcher": "ExactMatcher",
          "Pattern": "331133"
        }
      }
    ]
}

Something interesting is that the request match results don't seem to include anything about headers/exact matchers. Am I doing something wrong?

{
  ...
  "RequestMatchResult": {
    "TotalScore": 2.0,
    "TotalNumber": 2,
    "IsPerfectMatch": true,
    "AverageTotalScore": 1.0,
    "MatchDetails": [
      {
        "Name": "PathMatcher",
        "Score": 1.0
      },
      {
        "Name": "MethodMatcher",
        "Score": 1.0
      }
    ]
  },
  "PartialMappingGuid": "b5533495-a223-458d-b22a-1654ec0cd173",
  "PartialMappingTitle": null,
  "PartialRequestMatchResult": {
    "TotalScore": 2.0,
    "TotalNumber": 2,
    "IsPerfectMatch": true,
    "AverageTotalScore": 1.0,
    "MatchDetails": [
      {
        "Name": "PathMatcher",
        "Score": 1.0
      },
      {
        "Name": "MethodMatcher",
        "Score": 1.0
      }
    ]
  }
}
Originally created by @stopdropandrew on GitHub (Nov 24, 2022). ### Describe the bug Header matchers seem to be ignored. I'm using docker and I've got three json mappings. They each have the same path and method matchers and each have a unique header matcher. The header matching seems to not work. ### Test to reproduce mappings: ```json { ... "Headers": [ { "Accept": { "Matcher": "ExactMatcher", "Pattern": "application/json" } }, { "my-custom-header": { "Matcher": "ExactMatcher", "Pattern": "331133" } } ] } ``` ### Other related info Something interesting is that the request match results don't seem to include anything about headers/exact matchers. Am I doing something wrong? ```json { ... "RequestMatchResult": { "TotalScore": 2.0, "TotalNumber": 2, "IsPerfectMatch": true, "AverageTotalScore": 1.0, "MatchDetails": [ { "Name": "PathMatcher", "Score": 1.0 }, { "Name": "MethodMatcher", "Score": 1.0 } ] }, "PartialMappingGuid": "b5533495-a223-458d-b22a-1654ec0cd173", "PartialMappingTitle": null, "PartialRequestMatchResult": { "TotalScore": 2.0, "TotalNumber": 2, "IsPerfectMatch": true, "AverageTotalScore": 1.0, "MatchDetails": [ { "Name": "PathMatcher", "Score": 1.0 }, { "Name": "MethodMatcher", "Score": 1.0 } ] } } ```
adam added the question label 2025-12-29 15:24:37 +01:00
adam closed this issue 2025-12-29 15:24:37 +01:00
Author
Owner

@stopdropandrew commented on GitHub (Nov 24, 2022):

Changed the mapping format and it started working.

@stopdropandrew commented on GitHub (Nov 24, 2022): Changed the mapping format and it started working.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#469