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

verification of single-value header fails due to splitting at commas #1288

Open
torbendorc opened this issue Jan 14, 2021 · 0 comments
Open
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@torbendorc
Copy link

Hi there!

I tried to update to version 4.1.14 of au.com.dius.pact.provider:junit5spring and came over an issue that might be a regression on #1159.

We have a pact contract with an interaction that has an "Expires" header in it's response.

...
  "response": {
    "status": 200,
    "headers": {
      "Expires": "Sat, 27 Nov 1999 12:00:00 GMT",
      "Content-Type": "application/json"
    },
...

Till au.com.dius.pact.provider:junit5spring:4.1.6 the header was compared like this:

Comparing header 'Expires': 'Sat' to 'Sat'
Comparing header 'Expires': '27 Nov 1999 12:00:00 GMT' to '27 Nov 1999 12:00:00 GMT'

Since au.com.dius.pact.provider:junit5spring:4.1.7 the header is compared like this:

Comparing header 'Expires': 'Sat, 27 Nov 1999 12:00:00 GMT' to 'Sat'
Comparing header 'Expires': '' to '27 Nov 1999 12:00:00 GMT'

The latter fails verification.

Might be that this came along with fix fa0f3f9 that introduced a fixed list of SINGLE_VALUE_HEADERS, if I understood it corretly. So in the pact response model that is parsed from the http response there is just one key-value pair for single-value headers.
But in contrast to this the other side that parses the pact contract, that comes from the broker, doesn't know single-value headers and still splits the value at commas (see the model).

One might issue that the contract should have the single value in an array like this:

...
  "response": {
    "status": 200,
    "headers": {
      "Expires": ["Sat, 27 Nov 1999 12:00:00 GMT"],
      "Content-Type": "application/json"
    },
...

But this is no option when generating the contract with pact-js (web), i think.

I'm not sure whether I got the process right or not, but I hope my pre-analysis helps analysing this issue.

THX in advance for paying attention to this issue! 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants