fix(HTTP Request Node): Cleanup circular references in response (#6590)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Romain Dunand
2023-07-12 12:31:32 +02:00
committed by GitHub
parent aaa9ee3949
commit aecc05b787
7 changed files with 70 additions and 71 deletions

View File

@@ -7,7 +7,7 @@ import type {
INodeTypeDescription,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError, NodeOperationError, sleep } from 'n8n-workflow';
import { NodeApiError, NodeOperationError, sleep, removeCircularRefs } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
import type { IAuthDataSanitizeKeys } from '../GenericFunctions';
@@ -1022,12 +1022,12 @@ export class HttpRequestV2 implements INodeType {
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
// @ts-ignore
response = promisesResponses.shift();
if (response!.status !== 'fulfilled') {
if (!this.continueOnFail()) {
// throw error;
throw new NodeApiError(this.getNode(), response as JsonObject, { itemIndex });
} else {
removeCircularRefs(response.reason as JsonObject);
// Return the actual reason as error
returnItems.push({
json: {