feat(http): text/plain is allowed (#2376)

* feat(http): plan/txt is allowed

* Update http468.ts

* Update http468.ts

* body 添加string类型
This commit is contained in:
折戟沉沙、丿
2024-08-16 10:03:43 +08:00
committed by GitHub
parent 5545e84bb9
commit 5bf0dd0ef1
2 changed files with 5 additions and 2 deletions

View File

@@ -130,7 +130,7 @@ export type DispatchNodeResponseType = {
// http // http
params?: Record<string, any>; params?: Record<string, any>;
body?: Record<string, any>; body?: Record<string, any> | string;
headers?: Record<string, any>; headers?: Record<string, any>;
httpResult?: Record<string, any>; httpResult?: Record<string, any>;

View File

@@ -111,6 +111,9 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H
if (!httpJsonBody) return {}; if (!httpJsonBody) return {};
try { try {
httpJsonBody = replaceVariable(httpJsonBody, allVariables); httpJsonBody = replaceVariable(httpJsonBody, allVariables);
if (headers['Content-Type']?.includes('text/plain')) {
return httpJsonBody?.replaceAll(UNDEFINED_SIGN, 'null');
}
const jsonParse = JSON.parse(httpJsonBody); const jsonParse = JSON.parse(httpJsonBody);
const removeSignJson = removeUndefinedSign(jsonParse); const removeSignJson = removeUndefinedSign(jsonParse);
return removeSignJson; return removeSignJson;
@@ -196,7 +199,7 @@ async function fetchData({
method: string; method: string;
url: string; url: string;
headers: Record<string, any>; headers: Record<string, any>;
body: Record<string, any>; body: Record<string, any> | string;
params: Record<string, any>; params: Record<string, any>;
}) { }) {
const { data: response } = await axios({ const { data: response } = await axios({