From 7c4227bfc69a3f62d130780040259a461bc080f5 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Tue, 15 Feb 2022 23:09:15 +0100 Subject: [PATCH] fix(core): update --- ts/smartrequest.formdata.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/ts/smartrequest.formdata.ts b/ts/smartrequest.formdata.ts index b42483a..ee41739 100644 --- a/ts/smartrequest.formdata.ts +++ b/ts/smartrequest.formdata.ts @@ -72,14 +72,6 @@ export const postFormDataUrlEncoded = async ( optionsArg: interfaces.ISmartRequestOptions = {}, payloadArg: { key: string; content: string }[] ) => { - const requestOptions = { - ...optionsArg, - method: 'POST', - headers: { - ...optionsArg.headers, - 'content-type': 'application/x-www-form-urlencoded', - }, - }; let resultString = ''; @@ -92,7 +84,17 @@ export const postFormDataUrlEncoded = async ( )}`; } + const requestOptions: interfaces.ISmartRequestOptions = { + ...optionsArg, + method: 'POST', + headers: { + ...optionsArg.headers, + 'content-type': 'application/x-www-form-urlencoded', + }, + requestBody: resultString + }; + // lets fire the actual request for sending the formdata - const response = await request(`${urlArg}?${resultString}`, requestOptions); + const response = await request(urlArg, requestOptions); return response; };