MCPcopy
hub / github.com/postmanlabs/httpbin / CaseInsensitiveDict

Class CaseInsensitiveDict

httpbin/structures.py:11–27  ·  view source on GitHub ↗

Case-insensitive Dictionary for headers. For example, ``headers['content-encoding']`` will return the value of a ``'Content-Encoding'`` response header.

Source from the content-addressed store, hash-verified

9
10
11class CaseInsensitiveDict(dict):
12 """Case-insensitive Dictionary for headers.
13
14 For example, ``headers['content-encoding']`` will return the
15 value of a ``'Content-Encoding'`` response header.
16 """
17
18 def _lower_keys(self):
19 return [k.lower() for k in self.keys()]
20
21 def __contains__(self, key):
22 return key.lower() in self._lower_keys()
23
24 def __getitem__(self, key):
25 # We allow fall-through here, so values default to None
26 if key in self:
27 return list(self.items())[self._lower_keys().index(key.lower())][1]

Callers 6

redirect_toFunction · 0.85
dripFunction · 0.85
random_bytesFunction · 0.85
stream_random_bytesFunction · 0.85
range_requestFunction · 0.85
get_headersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…