Skip to content

Commit 2a7be5e

Browse files
authored
Do not force form-data-boundary, make it fully customizable
1 parent 72c6570 commit 2a7be5e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/FormDataEncoder.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ test("Accepts custom boundary as the second argument", t => {
5959

6060
const encoder = new FormDataEncoder(new FormData(), expected)
6161

62-
t.is(encoder.boundary, `form-data-boundary-${expected}`)
62+
t.is(encoder.boundary, expected)
6363
})
6464

6565
test("Has content-type string", t => {
@@ -108,7 +108,7 @@ test("Has content-type string with custom boundary string", t => {
108108

109109
t.is(
110110
encoder.contentType,
111-
`multipart/form-data; boundary=form-data-boundary-${expected}`
111+
`multipart/form-data; boundary=${expected}`
112112
)
113113
})
114114

src/FormDataEncoder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export class FormDataEncoder {
175175
this.#CRLF_BYTES = this.#encoder.encode(this.#CRLF)
176176
this.#CRLF_BYTES_LENGTH = this.#CRLF_BYTES.byteLength
177177

178-
this.boundary = `form-data-boundary-${boundary}`
178+
this.boundary = boundary;
179179
this.contentType = `multipart/form-data; boundary=${this.boundary}`
180180

181181
this.#footer = this.#encoder.encode(

0 commit comments

Comments
 (0)