fix(HTTP Request Node): Show detailed error message in the UI again (#5959)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-04-12 14:58:05 +02:00
committed by GitHub
parent 60d28fc761
commit e79679c023
7 changed files with 141 additions and 38 deletions

View File

@@ -578,7 +578,13 @@ function digestAuthAxiosConfig(
return axiosConfig;
}
async function proxyRequestToAxios(
type ConfigObject = {
auth?: { sendImmediately: boolean };
resolveWithFullResponse?: boolean;
simple?: boolean;
};
export async function proxyRequestToAxios(
workflow: Workflow,
additionalData: IWorkflowExecuteAdditionalData,
node: INode,
@@ -598,12 +604,6 @@ async function proxyRequestToAxios(
maxBodyLength: Infinity,
maxContentLength: Infinity,
};
type ConfigObject = {
auth?: { sendImmediately: boolean };
resolveWithFullResponse?: boolean;
simple?: boolean;
};
let configObject: ConfigObject;
if (uriOrObject !== undefined && typeof uriOrObject === 'string') {
axiosConfig.url = uriOrObject;
@@ -707,12 +707,17 @@ async function proxyRequestToAxios(
}
const message = `${response.status as number} - ${JSON.stringify(responseData)}`;
throw Object.assign(new Error(message, { cause: error }), {
throw Object.assign(error, {
message,
statusCode: response.status,
options: pick(config ?? {}, ['url', 'method', 'data', 'headers']),
error: responseData,
config: undefined,
request: undefined,
response: pick(response, ['headers', 'status', 'statusText']),
});
} else {
throw Object.assign(new Error(error.message, { cause: error }), {
throw Object.assign(error, {
options: pick(config ?? {}, ['url', 'method', 'data', 'headers']),
});
}