Skip to content

Commit 2e2494c

Browse files
authored
Update send_chunked docs to reflect streaming behaviour (#1281)
1 parent 7c84a5c commit 2e2494c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/plug/conn.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ defmodule Plug.Conn do
510510
the `chunk/2` function.
511511
512512
HTTP/2 does not support chunking and will instead stream the response without a
513-
transfer encoding. When using HTTP/1.1, the Cowboy adapter will stream the response
513+
transfer encoding. When using HTTP/1.1, the underlying adapter will stream the response
514514
instead of emitting chunks if the `content-length` header has been set before calling
515515
`send_chunked/2`.
516516
"""

lib/plug/conn/adapter.ex

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ defmodule Plug.Conn.Adapter do
105105

106106
@doc """
107107
Sends the given status, headers as the beginning of
108-
a chunked response to the client.
108+
a chunked response to the client. If the connection uses a
109+
protocol (such as HTTP/2) which does not support chunked encoding,
110+
the response should be sent in a streaming manner using the
111+
protocol's framing method. Likewise if the passed headers include
112+
a `content-length` header, the response should be streamed using
113+
content length framing.
109114
110115
Webservers are advised to return `nil` as the sent_body,
111116
since this function does not actually produce a body.

0 commit comments

Comments
 (0)