You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run a test w/ vcr, I'm getting a validation error about the headers not being a dict. After firing up a debugger, it seems like vcr.stubs.VCRHTTPResponse instead sets them to a http.client.HTTPMessage here:
Would it be possible to subclass, patch or otherwise modify how vcr handles response headers for urllib3? It looks like something similar might've been done for tornado, but I'm not super familiar with the available hooks:
Problem
I'm dealing with some pydantic models that are deserializing a
urrlib3.response.HTTPResponse
, and they expect the headers attribute to be a dict. It looks likeurllib3
deserializes headers into anHTTPHeaderDict
that inherits from dict in theHTTPResponse
constructor here:https://github.com/urllib3/urllib3/blob/b07a669bd970d69847801148286b726f0570b625/src/urllib3/response.py#L327-L330
When I run a test w/ vcr, I'm getting a validation error about the headers not being a dict. After firing up a debugger, it seems like
vcr.stubs.VCRHTTPResponse
instead sets them to ahttp.client.HTTPMessage
here:vcrpy/vcr/stubs/__init__.py
Line 82 in f3147f5
Solution
Would it be possible to subclass, patch or otherwise modify how vcr handles response headers for
urllib3
? It looks like something similar might've been done fortornado
, but I'm not super familiar with the available hooks:vcrpy/vcr/stubs/tornado_stubs.py
Lines 53 to 62 in f3147f5
The text was updated successfully, but these errors were encountered: