Skip to content

Commit 6e331ed

Browse files
authored
Update http.ios.ts
Make the name property more consistent.
1 parent 1dd1c5e commit 6e331ed

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/http.ios.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,17 +215,18 @@ export function request(options: HttpRequestOptions): Promise<HttpResponse> {
215215
formDataPartMediaType = value.type;
216216
}
217217

218+
const filename = value.name || "";
218219
if (value.data instanceof ArrayBuffer) {
219220
const buffer = new Uint8Array(value.data as ArrayBuffer);
220-
multipartFormData.addFileParameterNameFilenameContentType(NSData.dataWithData(buffer as any), key, value.name || "", formDataPartMediaType);
221+
multipartFormData.addFileParameterNameFilenameContentType(NSData.dataWithData(buffer as any), key, filename, formDataPartMediaType);
221222
} else if (value.data instanceof Blob) {
222223
// Stolen from core xhr, not sure if we should use InternalAccessor, but it provides fast access.
223224
// @ts-ignore
224225
const buffer = new Uint8Array(Blob.InternalAccessor.getBuffer(value.data).buffer.slice(0) as ArrayBuffer);
225-
multipartFormData.addFileParameterNameFilenameContentType(NSData.dataWithData(buffer as any), key, value.name || "", formDataPartMediaType);
226+
multipartFormData.addFileParameterNameFilenameContentType(NSData.dataWithData(buffer as any), key, filename, formDataPartMediaType);
226227
} else {
227228
// Support for native file objects.
228-
multipartFormData.addFileParameterNameFilenameContentType(value.data, key, value.name, formDataPartMediaType);
229+
multipartFormData.addFileParameterNameFilenameContentType(value.data, key, filename, formDataPartMediaType);
229230
}
230231
} else {
231232
// Support for native file objects.

0 commit comments

Comments
 (0)