Update the session headers with the request ones while ignoring certain name prefixes.
(self, request_headers: HTTPHeadersDict)
| 228 | return new_headers |
| 229 | |
| 230 | def update_headers(self, request_headers: HTTPHeadersDict): |
| 231 | """ |
| 232 | Update the session headers with the request ones while ignoring |
| 233 | certain name prefixes. |
| 234 | |
| 235 | """ |
| 236 | |
| 237 | new_headers = self._compute_new_headers(request_headers) |
| 238 | new_keys = new_headers.copy().keys() |
| 239 | |
| 240 | # New headers will take priority over the existing ones, and override |
| 241 | # them directly instead of extending them. |
| 242 | for key, value in self._headers.copy().items(): |
| 243 | if key in new_keys: |
| 244 | continue |
| 245 | |
| 246 | new_headers.add(key, value) |
| 247 | |
| 248 | self._headers = new_headers |
| 249 | |
| 250 | @property |
| 251 | def headers(self) -> HTTPHeadersDict: |
no test coverage detected