WSGI conform list of (header, value) tuples.
(self)
| 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) |