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

code changes for adding support for form parameter matching #2157

Merged

Conversation

kapishmalik
Copy link
Contributor

Resolves #383

Code changes for adding support for form parameter matching.

Added tests for mentioned scenarios:

  • Correct serialisation and deserialisation of the matcher.
  • Parameter keys that contain characters that would be URL encoded, in particular array-style keys like address[postcode]
  • Expected parameter values containing characters that would be URL encoded.
  • Diff report

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pull request! The binary compatibility issue in the interface needs to be fixed before this pull request can be merged.

@oleg-nenashev
Copy link
Member

FWIW, there is #2153 for providing clear separation between really public APIs and not so ones

@kapishmalik
Copy link
Contributor Author

incorporated review comment changes

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -60,6 +60,14 @@ interface Part {

QueryParameter queryParameter(String key);

default FormParameter formParameter(String key) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we ditch these defaults and ensure we've implemented these everywhere instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. We have implemented these everywhere. Oleg suggested adding this as it might break the implementation for those who might be using this interface as this is part of the library and exposed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that it is very unlikely that anyone using it as we are using this interface as the base for our receiving requests, matching etc it wherever required. Consumers of Wiremock may not be using it for any of these purposes. But it is always better to add a safety net.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something weird has happened to the formatting here so I can't really see what's actually changed. Please can you restore the formatting and add just your change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added my change but spotless check started failing. It was very minor test so I just removed it for now. Let me know if you have any work around to fix this.

@tomakehurst
Copy link
Member

Apart from the couple of minor comments above, looks good. Happy to merge this once these are resolved and Oleg's comment on the doc PR is also resolved.

1 similar comment
@tomakehurst
Copy link
Member

Apart from the couple of minor comments above, looks good. Happy to merge this once these are resolved and Oleg's comment on the doc PR is also resolved.

@tomakehurst
Copy link
Member

Looks like you've deleted your changes to RequestPatternTest entirely now?

We need some serialisation/deserialisation tests, which I think belong in there.

@kapishmalik
Copy link
Contributor Author

Looks like you've deleted your changes to RequestPatternTest entirely now?

We need some serialisation/deserialisation tests, which I think belong in there.

as discussed, first applied formatting changes followed by added new UTs.

actualJson,
true);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can we also have a test case showing that serialisation works correctly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, incorporated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you mean deserialization. I have now tests for both - serialization and deserialization.

@tomakehurst tomakehurst merged commit 2f9ad47 into wiremock:master Apr 29, 2023
7 checks passed
@tomakehurst
Copy link
Member

Great stuff, thanks!

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

Successfully merging this pull request may close these issues.

Add Form parameter matching ( Not query parameter matching)
3 participants