pact-net icon indicating copy to clipboard operation
pact-net copied to clipboard

Requesting enhancement to update query param and body param in post call in provider state before pact verification

Open tl-madhulika-mitra opened this issue 3 years ago • 15 comments
trafficstars

Hi , I found a post for JVM https://pactflow.io/blog/injecting-values-from-provider-states/ where we can modify the request before the validation, but is there a mechanism in C#?

tl-madhulika-mitra avatar Apr 11 '22 09:04 tl-madhulika-mitra

I don't believe so.

You could achieve this by adding some custom middleware to your test application that can transform the incoming request.

mefellows avatar Apr 11 '22 10:04 mefellows

Thank you @mefellows , @adamrodger- Could you let me know if we plan to add this for the upcoming versions, as currently we are adding some heavy middleware to support our chained requests.

tl-madhulika-mitra avatar Jun 09 '22 15:06 tl-madhulika-mitra

I don't fully understand the feature request if I'm honest.

It would be really helpful if you could create a proposal for the API changes with an explanation of what the changes do, and then we can discuss about feasibility/design.

For example, see issue #392 for a good format for proposing changes.

adamrodger avatar Jun 09 '22 18:06 adamrodger

to support our chained requests.

I'd be keen to understand this use case also. "chained requests" is an anti-pattern as far as contract testing is concerned, each request/response should be able to be tested in isolation.

Whilst the feature of essentially proxying incoming/outgoing bodies is doable, I'd be wary of adding features that readily enables improper use of the tool that will lead to future challenges for all parties.

mefellows avatar Jun 10 '22 02:06 mefellows

Closed due to inactivity

adamrodger avatar Oct 15 '23 15:10 adamrodger