summaryrefslogtreecommitdiffstats
path: root/Doc/library/contextvars.rst
diff options
context:
space:
mode:
authorsobolevn <mail@sobolevn.me>2024-09-09 13:58:49 (GMT)
committerGitHub <noreply@github.com>2024-09-09 13:58:49 (GMT)
commitb950831c941a37c37b68a771610e072d11d33331 (patch)
tree8b1e715d68b91094e12f3ea23acf2b4de9d74133 /Doc/library/contextvars.rst
parent9017b95ff2dcff16bcb0b0a609ed2b0daa845943 (diff)
downloadcpython-b950831c941a37c37b68a771610e072d11d33331.zip
cpython-b950831c941a37c37b68a771610e072d11d33331.tar.gz
cpython-b950831c941a37c37b68a771610e072d11d33331.tar.bz2
Mention `curl` in `contextvars` docs (#123838)
Diffstat (limited to 'Doc/library/contextvars.rst')
-rw-r--r--Doc/library/contextvars.rst10
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/library/contextvars.rst b/Doc/library/contextvars.rst
index b2261ea..2a79dfe 100644
--- a/Doc/library/contextvars.rst
+++ b/Doc/library/contextvars.rst
@@ -254,7 +254,7 @@ client::
# without passing it explicitly to this function.
client_addr = client_addr_var.get()
- return f'Good bye, client @ {client_addr}\n'.encode()
+ return f'Good bye, client @ {client_addr}\r\n'.encode()
async def handle_request(reader, writer):
addr = writer.transport.get_extra_info('socket').getpeername()
@@ -268,9 +268,10 @@ client::
print(line)
if not line.strip():
break
- writer.write(line)
- writer.write(render_goodbye())
+ writer.write(b'HTTP/1.1 200 OK\r\n') # status line
+ writer.write(b'\r\n') # headers
+ writer.write(render_goodbye()) # body
writer.close()
async def main():
@@ -282,5 +283,6 @@ client::
asyncio.run(main())
- # To test it you can use telnet:
+ # To test it you can use telnet or curl:
# telnet 127.0.0.1 8081
+ # curl 127.0.0.1:8081