Commit 5bf0dd0e by 折戟沉沙、丿 Committed by GitHub

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

* feat(http): plan/txt is allowed

* Update http468.ts

* Update http468.ts

* body 添加string类型
parent 5545e84b
...@@ -130,7 +130,7 @@ export type DispatchNodeResponseType = { ...@@ -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>;
......
...@@ -111,6 +111,9 @@ export const dispatchHttp468Request = async (props: HttpRequestProps): Promise<H ...@@ -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({ ...@@ -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({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment