WireMock.Net icon indicating copy to clipboard operation
WireMock.Net copied to clipboard

Case sensitive true is ignored for JsonMatcher

Open viktorpeacock opened this issue 7 years ago • 12 comments

The JSON matcher is doing a deep compare on JSON string and it looks like it's case sensitive. When creating a matcher, I specify CaseSensitive = false, but this is not used by the matcher. Should it be possible to configure JSON matcher to be case insensitive?

https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net/Matchers/JsonMatcher.cs

viktorpeacock avatar Aug 22 '19 10:08 viktorpeacock

This can be implemented, however only for strings.

StefH avatar Aug 22 '19 11:08 StefH

This would help a lot. Can try doing PR myself with a bit of direction on how you'd like this to be implemented.

viktorpeacock avatar Aug 22 '19 11:08 viktorpeacock

I'm looking into this.

StefH avatar Aug 22 '19 11:08 StefH

And would it be required to also match the property-names CaseIgnore? Or only the string-values?

StefH avatar Aug 22 '19 11:08 StefH

@viktorpeacock If you want to test this. see preview NuGet : WireMock.Net.1.0.28-ci-11761

StefH avatar Aug 22 '19 12:08 StefH

Hi, it would help if we could ignore case on both values and property names. Potentially have two properties: IgnoreCaseOnProperties and IgnoreCaseOnPropertyValues?

viktorpeacock avatar Aug 22 '19 14:08 viktorpeacock

Just a single IgnoreCase is easier to build and use I think.

StefH avatar Aug 22 '19 18:08 StefH

Please test WireMock.Net.1.0.28-ci-11769 , this version renames the property name + value.

StefH avatar Aug 22 '19 19:08 StefH

Any chance you can post a docker image please as we host wiremock in k8s?

Agree RE: IgnoreCase :-) Thank you so much for very fast response!

viktorpeacock avatar Aug 23 '19 08:08 viktorpeacock

I can merge this logic to the master and create a new Docker because (as far I see) the original logic is still the same. So tonight or tomorrow I will create new Docker.

StefH avatar Aug 23 '19 10:08 StefH

@viktorpeacock docker is created

StefH avatar Aug 24 '19 07:08 StefH

Thank you. Will try this out today!

viktorpeacock avatar Aug 28 '19 08:08 viktorpeacock