Skip to content

Commit c19df2e

Browse files
committed
FormDataEncoder.getContentLength() is no longer calculate the content-length value, but returns a value from FormDataEncoder.contentLength instead.
1 parent b3ee8a6 commit c19df2e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/FormDataEncoder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export class FormDataEncoder {
212212
/**
213213
* Returns form-data content length
214214
*/
215-
#getContentLength(): number {
215+
#getContentLength(): string {
216216
let length = 0
217217

218218
for (const [name, raw] of this.#form) {
@@ -225,7 +225,7 @@ export class FormDataEncoder {
225225
length += this.#CRLF_BYTES_LENGTH
226226
}
227227

228-
return length + this.#footer.byteLength
228+
return String(length + this.#footer.byteLength)
229229
}
230230

231231
/**
@@ -234,7 +234,7 @@ export class FormDataEncoder {
234234
* @deprecated Use FormDataEncoder.contentLength or FormDataEncoder.headers["Content-Length"] instead
235235
*/
236236
getContentLength(): number {
237-
return this.#getContentLength()
237+
return Number(this.contentLength)
238238
}
239239

240240
/**

0 commit comments

Comments
 (0)