Skip to content

Commit 90f9a50

Browse files
authored
Merge pull request #75 from mukaschultze/fix/formdata-strings-ios
fix: strings values not working in `HTTPFormDataEntry` on iOS
2 parents decd175 + 5cb24b6 commit 90f9a50

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/http.ios.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ export function request(options: HttpRequestOptions): Promise<HttpResponse> {
224224
// @ts-ignore
225225
const buffer = new Uint8Array(Blob.InternalAccessor.getBuffer(value.data).buffer.slice(0) as ArrayBuffer);
226226
multipartFormData.addFileParameterNameFilenameContentType(NSData.dataWithData(buffer as any), key, filename, formDataPartMediaType);
227+
} else if (typeof value.data === "string") {
228+
const buffer = new TextEncoder().encode(value.data);
229+
multipartFormData.addFileParameterNameFilenameContentType(NSData.dataWithData(buffer as any), key, filename, formDataPartMediaType);
227230
} else {
228231
// Support for native file objects.
229232
multipartFormData.addFileParameterNameFilenameContentType(value.data, key, filename, formDataPartMediaType);

0 commit comments

Comments
 (0)