@@ -163,3 +163,4 @@ import { HTTPError } from '../errors/HTTPError.js'; | ||
| if (originalBody) { | ||
| this.request = streamRequest(this.request, this._options.onUploadProgress); | ||
| // Pass original body to calculate size correctly (before it becomes a stream) | ||
| this.request = streamRequest(this.request, this._options.onUploadProgress, this._options.body); | ||
| } | ||
@@ -166,0 +167,0 @@ } |
| import type { Options } from '../types/options.js'; | ||
| export declare const getBodySize: (body?: BodyInit | null) => number; | ||
| export declare const streamResponse: (response: Response, onDownloadProgress: Options["onDownloadProgress"]) => Response; | ||
| export declare const streamRequest: (request: Request, onUploadProgress: Options["onUploadProgress"]) => Request; | ||
| export declare const streamRequest: (request: Request, onUploadProgress: Options["onUploadProgress"], originalBody?: BodyInit | null) => Request; |
@@ -86,4 +86,6 @@ import { usualFormBoundarySize } from '../core/constants.js'; | ||
| }; | ||
| export const streamRequest = (request, onUploadProgress) => { | ||
| const totalBytes = getBodySize(request.body); | ||
| // eslint-disable-next-line @typescript-eslint/ban-types | ||
| export const streamRequest = (request, onUploadProgress, originalBody) => { | ||
| // Use original body for size calculation since request.body is already a stream | ||
| const totalBytes = getBodySize(originalBody ?? request.body); | ||
| let transferredBytes = 0; | ||
@@ -90,0 +92,0 @@ return new Request(request, { |
+1
-1
| { | ||
| "name": "ky", | ||
| "version": "1.9.0", | ||
| "version": "1.9.1", | ||
| "description": "Tiny and elegant HTTP client based on the Fetch API", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
176780
0.4%1339
0.22%3
-25%