Open richard-reece opened 6 years ago
In general, we should refer to the HTTP spec to define the rules. The pact spec is clearly wrong.
@bethesque @mefellows we need to update the spec here, and make it consistent. I've looked at the JVM header matching code, and I don't think it is correct:
cookie
, split the value by semi-colon into a whitespace trimmed list, and the header matches if all the actual values contain the expected value at the same position
2.2 For content-type
, split the value by semi-colon and trim white-space, then compare the first value:
=
(stripping white-space) into a key-value map and compare case sensitive
2.3 otherwise strip any white-space after the commas in the values and compare case sensitive.This looks wrong, but it has worked to date because 99% of header values don't have multiple values and don't use parameters.
No worries, what should we change it to?
The JVM test case asserts various aspects of HTTP header behaviour that is not mentioned in the spec, which says "Exact string match for expected header names and values." This makes it more difficult (frustrating) to implement a verifier. Two behaviours exist in the test cases:
For future implementors of the spec, please add a clarification to the header that replaces "Exact string match for expected header names and values." with words more accurately reflecting what an implementation should do.
How full an implementation of HTTP header value parsing should be implemented in order to allow comparison?