Skip to content

Commit 47e9002

Browse files
committed
fix(android): support native data for form data parameters
1 parent 1a00cad commit 47e9002

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/https/request.android.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ export function createRequest(opts: HttpsRequestOptions, useLegacy: boolean = tr
468468
(opts.body as HttpsFormDataParam[]).forEach((param) => {
469469
if (param.fileName && param.contentType) {
470470
const MEDIA_TYPE = okhttp3.MediaType.parse(param.contentType);
471-
builder.addFormDataPart(param.parameterName, param.fileName, okhttp3.RequestBody.create(MEDIA_TYPE, param.data));
471+
builder.addFormDataPart(param.parameterName, param.fileName, okhttp3.RequestBody.create(param.data, MEDIA_TYPE));
472472
} else {
473473
if (typeof param.data === 'string') {
474474
builder.addFormDataPart(param.parameterName, param.data);
@@ -478,7 +478,6 @@ export function createRequest(opts: HttpsRequestOptions, useLegacy: boolean = tr
478478
}
479479
});
480480
okHttpBody = builder.build();
481-
482481
} else if (type === 'application/x-www-form-urlencoded') {
483482
const builder = new okhttp3.FormBody.Builder();
484483
Object.keys(opts.body).forEach((key) => {

0 commit comments

Comments
 (0)