MCPcopy
hub / github.com/httpie/cli / update_headers

Method update_headers

httpie/sessions.py:230–248  ·  view source on GitHub ↗

Update the session headers with the request ones while ignoring certain name prefixes.

(self, request_headers: HTTPHeadersDict)

Source from the content-addressed store, hash-verified

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:

Callers 1

collect_messagesFunction · 0.80

Calls 3

_compute_new_headersMethod · 0.95
addMethod · 0.80
itemsMethod · 0.45

Tested by

no test coverage detected