MCPcopy Index your code
hub / github.com/fluentpython/example-code-2e / headerlist

Method headerlist

21-async/mojifinder/bottle.py:1565–1580  ·  view source on GitHub ↗

WSGI conform list of (header, value) tuples.

(self)

Source from the content-addressed store, hash-verified

1563
1564 @property
1565 def headerlist(self):
1566 """ WSGI conform list of (header, value) tuples. """
1567 out = []
1568 headers = list(self._headers.items())
1569 if 'Content-Type' not in self._headers:
1570 headers.append(('Content-Type', [self.default_content_type]))
1571 if self._status_code in self.bad_headers:
1572 bad_headers = self.bad_headers[self._status_code]
1573 headers = [h for h in headers if h[0] not in bad_headers]
1574 out += [(name, val) for (name, vals) in headers for val in vals]
1575 if self._cookies:
1576 for c in self._cookies.values():
1577 out.append(('Set-Cookie', _hval(c.OutputString())))
1578 if py3k:
1579 out = [(k, v.encode('utf8').decode('latin1')) for (k, v) in out]
1580 return out
1581
1582 content_type = HeaderProperty('Content-Type')
1583 content_length = HeaderProperty('Content-Length', reader=int)

Callers

nothing calls this directly

Calls 5

_hvalFunction · 0.85
valuesMethod · 0.80
decodeMethod · 0.80
itemsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected