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

FormPostBuilder.parameterFromProviderState does not function #1610

Closed
CallumKerson opened this issue Sep 21, 2022 · 2 comments
Closed

FormPostBuilder.parameterFromProviderState does not function #1610

CallumKerson opened this issue Sep 21, 2022 · 2 comments

Comments

@CallumKerson
Copy link

CallumKerson commented Sep 21, 2022

The method parameterFromProviderState in the class FormPostBuilder does not actually allow for values to be delivered from the provider when doing provider tests. This is due to the method Generators.findContentTypeHandler returning null for the content type application/x-www-form-urlencoded, which is what is provided by the FormPostBuilder class.

The result is that when specifying a FormPostBuilder.parameterFromProviderState, the parameter appears with the expression in the contract JSON, but when a provider test provides a value for the expression it is not evaluated.

Indeed looking at the Generators class the only content type supported there is application/json. Is the intent that parameters from Provider states only work for json bodies? Or should the Generators class also support application/x-www-form-urlencoded?

@rholshausen
Copy link
Contributor

I added support for generators with form URL encoded bodies. There was also a bug with the FormPostBuilder, so any Pact files will need to be generated with the corrected builder.

@rholshausen
Copy link
Contributor

Fix released with version 4.3.16

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