mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
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:
@@ -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
|
|||||||
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({
|
||||||
|
Reference in New Issue
Block a user