responses icon indicating copy to clipboard operation
responses copied to clipboard

recorder: use a case-insensitive HTTP headers check

Open ptalbert opened this issue 1 year ago • 1 comments

_recorder._remove_default_headers() does a case-sensitive check for HTTP header field names are case insensitive. The result is that for example, a lower-case 'content-type' field will not be removed. Later, when _add_from_file tries to load the data using RequestsMock.add(), a RuntimeError exception will be raised when it finds the 'content_type' kwarg was passed and 'content-type' is in the 'headers' kwargs.

Fix this by simply having _remove_default_headers() do a case-insensitive check.

ptalbert avatar Jul 10 '24 13:07 ptalbert

This should also resolve #724

andrew-womeldorf-smar avatar Sep 06 '24 12:09 andrew-womeldorf-smar