MCPcopy
hub / github.com/tornadoweb/tornado / raw_fetch

Method raw_fetch

tornado/test/httpserver_test.py:208–222  ·  view source on GitHub ↗
(self, headers, body, newline=b"\r\n")

Source from the content-addressed store, hash-verified

206 return Application(self.get_handlers())
207
208 def raw_fetch(self, headers, body, newline=b"\r\n"):
209 with closing(IOStream(socket.socket())) as stream:
210 self.io_loop.run_sync(
211 lambda: stream.connect(("127.0.0.1", self.get_http_port()))
212 )
213 stream.write(
214 newline.join(headers + [utf8("Content-Length: %d" % len(body))])
215 + newline
216 + newline
217 + body
218 )
219 start_line, headers, body = self.io_loop.run_sync(
220 lambda: read_stream_body(stream)
221 )
222 return body
223
224 def test_multipart_form(self):
225 # Encodings here are tricky: Headers are latin1, bodies can be

Callers 2

test_multipart_formMethod · 0.95
test_newlinesMethod · 0.95

Calls 8

IOStreamClass · 0.90
utf8Function · 0.90
read_stream_bodyFunction · 0.85
run_syncMethod · 0.80
joinMethod · 0.80
connectMethod · 0.45
get_http_portMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected