Skip to content

Commit

Permalink
feat(http): text/plain is allowed (#2376)
Browse files Browse the repository at this point in the history
* feat(http): plan/txt is allowed

* Update http468.ts

* Update http468.ts

* body 添加string类型
  • Loading branch information
bincooo authored Aug 16, 2024
1 parent 5545e84 commit 5bf0dd0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/global/core/workflow/runtime/type.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export type DispatchNodeResponseType = {

// http
params?: Record<string, any>;
body?: Record<string, any>;
body?: Record<string, any> | string;
headers?: Record<string, any>;
httpResult?: Record<string, any>;

Expand Down
5 changes: 4 additions & 1 deletion packages/service/core/workflow/dispatch/tools/http468.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
if (!httpJsonBody) return {};
try {
httpJsonBody = replaceVariable(httpJsonBody, allVariables);
if (headers['Content-Type']?.includes('text/plain')) {
return httpJsonBody?.replaceAll(UNDEFINED_SIGN, 'null');
}
const jsonParse = JSON.parse(httpJsonBody);
const removeSignJson = removeUndefinedSign(jsonParse);
return removeSignJson;
Expand Down Expand Up @@ -196,7 +199,7 @@ async function fetchData({
method: string;
url: string;
headers: Record<string, any>;
body: Record<string, any>;
body: Record<string, any> | string;
params: Record<string, any>;
}) {
const { data: response } = await axios({
Expand Down

0 comments on commit 5bf0dd0

Please sign in to comment.