Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`. ...what? Basically, expose the parsed HTTP headers from the server response the way `http.cookiejar` expects to see them.
| 112 | |
| 113 | |
| 114 | class MockResponse: |
| 115 | """Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`. |
| 116 | |
| 117 | ...what? Basically, expose the parsed HTTP headers from the server response |
| 118 | the way `http.cookiejar` expects to see them. |
| 119 | """ |
| 120 | |
| 121 | def __init__(self, headers: Any) -> None: |
| 122 | """Make a MockResponse for `cookiejar` to read. |
| 123 | |
| 124 | :param headers: a httplib.HTTPMessage or analogous carrying the headers |
| 125 | """ |
| 126 | self._headers = headers |
| 127 | |
| 128 | def info(self) -> Any: |
| 129 | return self._headers |
| 130 | |
| 131 | def getheaders(self, name: str) -> Any: |
| 132 | self._headers.getheaders(name) |
| 133 | |
| 134 | |
| 135 | def extract_cookies_to_jar( |
no outgoing calls
no test coverage detected