MCPcopy
hub / github.com/aio-libs/aiohttp / start_response

Method start_response

aiohttp/wsgi.py:208–234  ·  view source on GitHub ↗
(self, status, headers, exc_info=None)

Source from the content-addressed store, hash-verified

206 self.message = message
207
208 def start_response(self, status, headers, exc_info=None):
209 if exc_info:
210 try:
211 if self.status:
212 raise exc_info[1]
213 finally:
214 exc_info = None
215
216 status_code = int(status.split(' ', 1)[0])
217
218 self.status = status
219 resp = self.response = aiohttp.Response(
220 self.writer, status_code,
221 self.message.version, self.message.should_close)
222 resp.HOP_HEADERS = self.HOP_HEADERS
223 for name, value in headers:
224 resp.add_header(name, value)
225
226 if resp.has_chunked_hdr:
227 resp.enable_chunked_encoding()
228
229 # send headers immediately for websocket connection
230 if status_code == 101 and resp.upgrade and resp.websocket:
231 resp.send_headers()
232 else:
233 resp._send_headers = True
234 return self.response.write

Calls 3

add_headerMethod · 0.80
send_headersMethod · 0.80