Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store Mapping per POST request ignores "IgnoreCase" property of HeaderModel #1003

Closed
cal-schleupen opened this issue Sep 26, 2023 · 4 comments
Assignees
Labels

Comments

@cal-schleupen
Copy link
Contributor

cal-schleupen commented Sep 26, 2023

Describe the bug

When storing a mapping via https://localhost:54544/__admin/mappings using the following request

{
    "Guid": "905dca41-a045-4b63-9298-e0fe956c972b",
    "SaveToFile": true,
    "Title": "mytest",
    "Request": {
        "Path": {
            "Matchers": [
                {
                    "Name": "WildcardMatcher",
                    "Pattern": "/Sample"
                }
            ]
        },
        "Methods": [
            "post"
        ],
				"Headers": [
					{
						"Name": "Content-Type",
						"Matchers": [
							{
								"Name": "WildcardMatcher",
								"Pattern": "text/xml; charset=utf-8",
								"IgnoreCase": true
							}
						],
						"IgnoreCase": true
					},
					{
						"Name": "SOAPAction",
						"Matchers": [
							{
								"Name": "WildcardMatcher",
								"Pattern": "mypattern",
								"IgnoreCase": true
							}
						],
						"IgnoreCase": true
					}
				]
    },
    "Response": {
        "StatusCode": 200,
        "Body": "{ ... }",
        "Headers": {
            "Content-Type": "text/xml"
        }
    }
}

the following mapping is persisted in the file mytest.json:

{
  "Guid": "905dca41-a045-4b63-9298-e0fe956c972b",
  "UpdatedAt": "2023-09-26T11:39:54.6342741Z",
  "Title": "mytest",
  "Request": {
    "Path": {
      "Matchers": [
        {
          "Name": "WildcardMatcher",
          "Pattern": "/Sample",
          "IgnoreCase": false
        }
      ]
    },
    "Methods": [
      "post"
    ],
    "Headers": [
      {
        "Name": "Content-Type",
        "Matchers": [
          {
            "Name": "WildcardMatcher",
            "Pattern": "text/xml; charset=utf-8",
            "IgnoreCase": true
          }
        ]
      },
      {
        "Name": "SOAPAction",
        "Matchers": [
          {
            "Name": "WildcardMatcher",
            "Pattern": "mypattern",
            "IgnoreCase": true
          }
        ]
      }
    ]
  },
  "Response": {
    "StatusCode": 200,
    "Body": "{ ... }",
    "Headers": {
      "Content-Type": "text/xml"
    }
  }
}

Expected behavior:

Expectation: The attribute "IgnoreCase": true of the HeaderModel is stored.

Test to reproduce

See above.

Other related info

The bug is located in class MappingConverter:

                Headers = headerMatchers.Any() ? headerMatchers.Select(hm => new HeaderModel
                {
                    Name = hm.Name,
                    Matchers = _mapper.Map(hm.Matchers),
// -> is missing                    IgnoreCase = hm.IgnoreCase
                }).ToList() : null,

To me not as important this, the same problem exists with RejectOnMatch, which cannot be solved as easy as IgnoreCase.

@StefH StefH self-assigned this Sep 26, 2023
@StefH StefH changed the title Store Mapping per POST request ignores "Ignores" attribute of HeaderModel Store Mapping per POST request ignores "IgnoreCase" property of HeaderModel Sep 26, 2023
@StefH
Copy link
Collaborator

StefH commented Sep 26, 2023

#1004

@StefH
Copy link
Collaborator

StefH commented Sep 26, 2023

Fixed

@StefH StefH closed this as completed Sep 26, 2023
@cal-schleupen
Copy link
Contributor Author

Thanx a lot!

@StefH
Copy link
Collaborator

StefH commented Sep 27, 2023

New NuGet will be released later today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants