Skip to content

Commit 5be6c4e

Browse files
[3.13] Mention curl in contextvars docs (GH-123838) (#123868)
Mention `curl` in `contextvars` docs (GH-123838) (cherry picked from commit b950831) Co-authored-by: sobolevn <[email protected]>
1 parent 90bd056 commit 5be6c4e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Doc/library/contextvars.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ client::
254254
# without passing it explicitly to this function.
255255

256256
client_addr = client_addr_var.get()
257-
return f'Good bye, client @ {client_addr}\n'.encode()
257+
return f'Good bye, client @ {client_addr}\r\n'.encode()
258258

259259
async def handle_request(reader, writer):
260260
addr = writer.transport.get_extra_info('socket').getpeername()
@@ -268,9 +268,10 @@ client::
268268
print(line)
269269
if not line.strip():
270270
break
271-
writer.write(line)
272271

273-
writer.write(render_goodbye())
272+
writer.write(b'HTTP/1.1 200 OK\r\n') # status line
273+
writer.write(b'\r\n') # headers
274+
writer.write(render_goodbye()) # body
274275
writer.close()
275276

276277
async def main():
@@ -282,5 +283,6 @@ client::
282283

283284
asyncio.run(main())
284285

285-
# To test it you can use telnet:
286+
# To test it you can use telnet or curl:
286287
# telnet 127.0.0.1 8081
288+
# curl 127.0.0.1:8081

0 commit comments

Comments
 (0)