You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/3-streams.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ This constructor takes the same arguments as the Got promise.
21
21
> To filter which headers are copied, listen to the `response` event and modify `response.headers` before piping to the destination.
22
22
23
23
**Note:**
24
-
> If the `body`, `json` or `form` option is used, this stream will be read-only.
24
+
> If the `body`, `json` or `form` option is used, this stream will be read-only. Check [`stream.isReadonly`](#streamisreadonly) to detect this condition.
25
25
26
26
**Note:**
27
27
> - While `got.post('https://example.com')` resolves, `got.stream.post('https://example.com')` will hang indefinitely until a body is provided.
@@ -169,6 +169,12 @@ Whether the response has been fetched from cache.
169
169
170
170
Whether the socket was used for other previous requests.
171
171
172
+
### `stream.isReadonly`
173
+
174
+
**Type: `boolean`**
175
+
176
+
Whether the stream is read-only. Returns `true` when `body`, `json`, or `form` options are provided.
0 commit comments