def test_dump_header(self): assert http.dump_header([1, 2, 3]) == '1, 2, 3' assert http.dump_header([1, 2, 3], allow_token=False) == '"1", "2", "3"' assert http.dump_header({'foo': 'bar'}, allow_token=False) == 'foo="bar"' assert http.dump_header({'foo': 'bar'}) == 'foo=bar'
def test_dump_header(self): assert http.dump_header([1, 2, 3]) == "1, 2, 3" assert http.dump_header([1, 2, 3], allow_token=False) == '"1", "2", "3"' assert http.dump_header({"foo": "bar"}, allow_token=False) == 'foo="bar"' assert http.dump_header({"foo": "bar"}) == "foo=bar"
def fset(self, value): if not value: del self.headers[name] elif isinstance(value, str): self.headers[name] = value else: self.headers[name] = dump_header(value)
def fset( self: "Response", value: t.Optional[t.Union[str, t.Dict[str, t.Union[str, int]], t.Iterable[str]]], ) -> None: if not value: del self.headers[name] elif isinstance(value, str): self.headers[name] = value else: self.headers[name] = dump_header(value)
def add_headers(self, response): response = make_response(response) auth = request.authorization hA1 = self.get_key(auth.username) hA2 = hash_all('', auth.uri) rspauth = digest(hA1, hA2) response.headers['Authentication-Info'] = dump_header({ 'rspauth': rspauth, 'qop': auth.qop, 'cnonce': auth.cnonce, 'nc': auth.nc }) return response
def set_digest(self, realm, nonce, qop = ('auth',), opaque = None, algorithm = None, stale = False): d = {'__auth_type__': 'digest', 'realm': realm, 'nonce': nonce, 'qop': dump_header(qop)} if stale: d['stale'] = 'TRUE' if opaque is not None: d['opaque'] = opaque if algorithm is not None: d['algorithm'] = algorithm dict.clear(self) dict.update(self, d) if self.on_update: self.on_update(self)
def access_control_expose_headers(self, value: HeaderSet) -> None: self.headers["Access-Control-Expose-Headers"] = dump_header(value)
def access_control_allow_methods(self, value: HeaderSet) -> None: self.headers["Access-Control-Allow-Methods"] = dump_header(value)
def to_header(self): return dump_header(self)