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

Request Path and query parameter keys are case-sensitive #253

Closed
simardst opened this issue Mar 6, 2019 · 11 comments
Closed

Request Path and query parameter keys are case-sensitive #253

simardst opened this issue Mar 6, 2019 · 11 comments

Comments

@simardst
Copy link

simardst commented Mar 6, 2019

In many cases, the casing of the request path and the querystring keys (not the values) is not important. It would be very usefull to:

  • be able to match the request path in a case-insensitive way.
  • be able to math the request querystring keys in a case insensitive way.

This could be a global settings or configurable for each request (whatever is the simplest way to implement it).

@StefH
Copy link
Collaborator

StefH commented Mar 6, 2019

For path , you should be able to use:

"Request": {
        "Path": {
            "Matchers": [
                {
                    "Name": "WildcardMatcher",
                    "Pattern": "/param2",
                    "IgnoreCase": true
                }
            ]
        },
        "Methods": [
            "get"
        ]
    },

@simardst
Copy link
Author

simardst commented Mar 6, 2019

Thank you, but achieving the same for the querystring keys is far more complex. I achieved to create an extension for the path, but didn't find any way to do the same with the querystring keys.

@StefH
Copy link
Collaborator

StefH commented Mar 6, 2019

Cookies and Headers do support this logic.

But I think indeed that querystring does not support this.

I will take a look at the code to ser if I can add logic.

@StefH
Copy link
Collaborator

StefH commented Mar 7, 2019

I've updated the code and new NuGet is available on MyGet (https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)
WireMock.Net.1.0.8-ci-11023

Use it like:

{
    "Guid": "6dcb57d1-2571-48d8-98fd-fc1c877104d3",
    "Request": {
        "Path": {
            "Matchers": [
                {
                    "Name": "WildcardMatcher",
                    "Pattern": "/param",
                    "IgnoreCase": true
                }
            ]
        },
        "Methods": [
            "get"
        ],
        "Params": [
            {
                "Name": "KeY",
                "IgnoreCase": true,
                "Matchers": [
                    {
                        "Name": "ExactMatcher",
                        "Pattern": "test"
                    }
                ]
            }
        ]
    },
    "Response": {
        "BodyAsJson": {
            "result": "!!!"
        }
    }
}

Will match:
http://localhost/param?key=test
and
http://localhost/param?kEY=test

@StefH
Copy link
Collaborator

StefH commented Mar 8, 2019

@simardst does this work for you?

@simardst
Copy link
Author

simardst commented Mar 8, 2019

This seems to resolve our issues, and I will test it using your preview version by the end of the day.
Thank you very much.

@StefH
Copy link
Collaborator

StefH commented Mar 8, 2019

You're welcome.

If you have tested and all is working as expected, I'll merge this code to master and create a new official nuget.

@simardst
Copy link
Author

simardst commented Mar 8, 2019

I, ve done few tests. This works perfectly!
I will update as soon as it is available.

@StefH
Copy link
Collaborator

StefH commented Mar 9, 2019

So all is tested and I can merge and create a new official NuGet?

@simardst
Copy link
Author

As far as I'm concerned, yes you can proceed.

@StefH
Copy link
Collaborator

StefH commented Mar 12, 2019

A new NuGet will be released soon.

@StefH StefH closed this as completed Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants