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

Function test_send_headers

tests/test_protocol.py:253–269  ·  view source on GitHub ↗
(transport)

Source from the content-addressed store, hash-verified

251
252
253def test_send_headers(transport):
254 write = transport.write = mock.Mock()
255
256 msg = protocol.Response(transport, 200)
257 msg.add_headers(('content-type', 'plain/html'))
258 assert not msg.is_headers_sent()
259
260 msg.send_headers()
261
262 content = b''.join([arg[1][0] for arg in list(write.mock_calls)])
263
264 assert content.startswith(b'HTTP/1.1 200 OK\r\n')
265 assert b'CONTENT-TYPE: plain/html' in content
266 assert msg.headers_sent
267 assert msg.is_headers_sent()
268 # cleanup
269 msg.writer.close()
270
271
272def test_send_headers_non_ascii(transport):

Callers

nothing calls this directly

Calls 4

add_headersMethod · 0.80
is_headers_sentMethod · 0.80
send_headersMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected