Skip to content

Commit

Permalink
Added url-encoded body support to restapi plugin (ToolJet#3218)
Browse files Browse the repository at this point in the history
* Added url-encoded body support to restapi plugin

* Refactored the code
  • Loading branch information
shah21 authored Jun 10, 2022
1 parent 0d4d8f4 commit f215f89
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/packages/restapi/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export default class RestapiQueryService implements QueryService {

const headers = this.headers(sourceOptions, queryOptions, hasDataSource);
const customQueryParams = sanitizeCustomParams(sourceOptions['custom_query_params']);
const isUrlEncoded = this.checkIfContentTypeIsURLenc(queryOptions['headers']);

/* Chceck if OAuth tokens exists for the source if query requires OAuth */
if (requiresOauth) {
Expand Down Expand Up @@ -142,7 +143,7 @@ export default class RestapiQueryService implements QueryService {
...paramsFromUrl,
...this.searchParams(sourceOptions, queryOptions, hasDataSource),
},
json,
...(isUrlEncoded ? { form: json } : { json }),
};

if (authType === 'basic') {
Expand Down

0 comments on commit f215f89

Please sign in to comment.