got 14.6.5 → 14.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -24,8 +24,6 @@ import { generateRequestId, publishRequestCreate, publishRequestStart, publishRe
|
|
|
24
24
|
const supportsBrotli = is.string(process.versions.brotli);
|
|
25
25
|
const supportsZstd = is.string(process.versions.zstd);
|
|
26
26
|
const methodsWithoutBody = new Set(['GET', 'HEAD']);
|
|
27
|
-
// Methods that should auto-end streams when no body is provided
|
|
28
|
-
const methodsWithoutBodyStream = new Set(['OPTIONS', 'DELETE', 'PATCH']);
|
|
29
27
|
const cacheableStore = new WeakableMap();
|
|
30
28
|
const redirectCodes = new Set([300, 301, 302, 303, 304, 307, 308]);
|
|
31
29
|
// Track errors that have been processed by beforeError hooks to preserve custom error types
|
|
@@ -923,8 +921,7 @@ export default class Request extends Duplex {
|
|
|
923
921
|
else if (is.undefined(body)) {
|
|
924
922
|
// No body to send, end the request
|
|
925
923
|
const cannotHaveBody = methodsWithoutBody.has(this.options.method) && !(this.options.method === 'GET' && this.options.allowGetBody);
|
|
926
|
-
|
|
927
|
-
if ((this._noPipe ?? false) || cannotHaveBody || currentRequest !== this || shouldAutoEndStream) {
|
|
924
|
+
if ((this._noPipe ?? false) || cannotHaveBody || currentRequest !== this) {
|
|
928
925
|
currentRequest.end();
|
|
929
926
|
}
|
|
930
927
|
}
|
package/dist/source/types.d.ts
CHANGED
|
@@ -243,6 +243,8 @@ export type Got<GotOptions extends ExtendOptions = ExtendOptions> = {
|
|
|
243
243
|
- uploadProgress
|
|
244
244
|
- downloadProgress
|
|
245
245
|
- error
|
|
246
|
+
|
|
247
|
+
Note: For writable request streams, call `stream.end()` when you are not piping a body. `got.stream` does not auto-end for OPTIONS, DELETE, or PATCH so you can pipe or write a body without getting `write after end`.
|
|
246
248
|
*/
|
|
247
249
|
stream: GotStream;
|
|
248
250
|
/**
|