`WebMock::Util::Headers.normalize_headers` downcases characters in header keys
This stub, chained with with(), will never match its intended request...
stub_request(:post, /urlmatcher/).
with(headers: {
"SOAPAction" => "https://some.soap.endpoint/where/things/happen"
})
because the stub's HeadersPattern has been normalized and no longer matches the given header. Note Soapaction instead of SOAPAction.
#<WebMock::HeadersPattern:0x00007fe38db8b078
@pattern={"Soapaction"=>"https://www.assuresign.net/Services/DocumentNOW/Envelopes/IEnvelopeService/CreateEnvelope"}>
@ulyssesrex thank you for pointing that. SOAPAction is indeed a culprit. I guess this can be changed in WebMock but with major version change in WebMock as I it would break many existing WebMock setups, where people set header expectations using e.g lowercase.
The normalized form of headers which is enforced by HTTP/2 is lowercase.
Thank you for the input @ioquatix It's only for HTTP/2 right?
It's also for HTTP/1.
https://stackoverflow.com/questions/5258977/are-http-headers-case-sensitive
HTTP/2 just makes it an error and servers will drop the connection.
Just FYI, this will become standard rack behaviour too: https://github.com/rack/rack/issues/1592