@@ -3,7 +3,7 @@ import isPlainObject from "./util/isPlainObject.js"
3
3
import normalize from "./util/normalizeValue.js"
4
4
import escape from "./util/escapeName.js"
5
5
6
- import { isFileLike } from "./util/isFileLike .js"
6
+ import { isFile } from "./util/isFile .js"
7
7
import { isFormData } from "./util/isFormData.js"
8
8
import { FormDataLike } from "./FormDataLike.js"
9
9
import { FileLike } from "./FileLike.js"
@@ -185,14 +185,14 @@ export class FormDataEncoder {
185
185
header += `${ this . #DASHES} ${ this . boundary } ${ this . #CRLF} `
186
186
header += `Content-Disposition: form-data; name="${ escape ( name ) } "`
187
187
188
- if ( isFileLike ( value ) ) {
188
+ if ( isFile ( value ) ) {
189
189
header += `; filename="${ escape ( value . name ) } "${ this . #CRLF} `
190
190
header += `Content-Type: ${ value . type || "application/octet-stream" } `
191
191
}
192
192
193
193
if ( this . #options. enableAdditionalHeaders === true ) {
194
194
header += `${ this . #CRLF} Content-Length: ${
195
- isFileLike ( value ) ? value . size : value . byteLength
195
+ isFile ( value ) ? value . size : value . byteLength
196
196
} `
197
197
}
198
198
@@ -206,11 +206,11 @@ export class FormDataEncoder {
206
206
let length = 0
207
207
208
208
for ( const [ name , raw ] of this . #form) {
209
- const value = isFileLike ( raw ) ? raw : this . #encoder. encode ( normalize ( raw ) )
209
+ const value = isFile ( raw ) ? raw : this . #encoder. encode ( normalize ( raw ) )
210
210
211
211
length += this . #getFieldHeader( name , value ) . byteLength
212
212
213
- length += isFileLike ( value ) ? value . size : value . byteLength
213
+ length += isFile ( value ) ? value . size : value . byteLength
214
214
215
215
length += this . #CRLF_BYTES_LENGTH
216
216
}
@@ -256,7 +256,7 @@ export class FormDataEncoder {
256
256
*/
257
257
* values ( ) : Generator < Uint8Array | FileLike , void , undefined > {
258
258
for ( const [ name , raw ] of this . #form. entries ( ) ) {
259
- const value = isFileLike ( raw ) ? raw : this . #encoder. encode ( normalize ( raw ) )
259
+ const value = isFile ( raw ) ? raw : this . #encoder. encode ( normalize ( raw ) )
260
260
261
261
yield this . #getFieldHeader( name , value )
262
262
@@ -301,7 +301,7 @@ export class FormDataEncoder {
301
301
*/
302
302
async * encode ( ) : AsyncGenerator < Uint8Array , void , undefined > {
303
303
for ( const part of this . values ( ) ) {
304
- if ( isFileLike ( part ) ) {
304
+ if ( isFile ( part ) ) {
305
305
yield * part . stream ( )
306
306
} else {
307
307
yield part
0 commit comments