pact-foundation / pact-reference

Reference implementations for the pact specifications
https://pact.io
MIT License
91 stars 46 forks source link

Content-Type header expects duplicate values #302

Open mefellows opened 11 months ago

mefellows commented 11 months ago

Rather than repeat the repro/details, this is an upstream issue to track https://github.com/pact-foundation/pact-js/issues/1106.

github-actions[bot] commented 11 months ago

👋 Hi! The 'smartbear-supported' label has just been added to this issue, which will create an internal tracking ticket in PactFlow's Jira (PACT-1220). We will use this to prioritise and assign a team member to this task. All activity will be public on this ticket. For now, sit tight and we'll update this ticket once we have more information on the next steps.

See our documentation for more information.

YOU54F commented 11 months ago

Yes also seen this

https://github.com/pact-foundation/pact-reference/issues/305#issuecomment-1667710620

Should be actually be warning the user on the consumer side that they have duplicate values in the content-type header.

I think it stems from setting a request header with content type and a body in which you need to set the content_type header, it states that it should use the content_type header if set.

Is there ever a case for a multi-value content-type header that has the same value as both indexes? or would you expect to have something else like a variant application/json+problem;

mefellows commented 11 months ago

It's a bug, in that prior to this version the behaviour was different. Any implementation that allows a user to specify the content-type header (which would be all of them) will have this problem, and you actually want to be able to do this to make the test explicit. Guarding this in the FFI client libraries means a lot of duplication.