mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(HTTP Request Node): Cleanup circular references in response (#6590)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -8,12 +8,11 @@ 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';
|
||||
import { replaceNullValues, sanitizeUiMessage } from '../GenericFunctions';
|
||||
|
||||
interface OptionData {
|
||||
name: string;
|
||||
displayName: string;
|
||||
@@ -976,6 +975,7 @@ export class HttpRequestV1 implements INodeType {
|
||||
// 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: {
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -12,7 +12,16 @@ import type {
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { BINARY_ENCODING, jsonParse, NodeApiError, NodeOperationError, sleep } from 'n8n-workflow';
|
||||
import {
|
||||
BINARY_ENCODING,
|
||||
jsonParse,
|
||||
NodeApiError,
|
||||
NodeOperationError,
|
||||
sleep,
|
||||
removeCircularRefs,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { keysToLowercase } from '@utils/utilities';
|
||||
|
||||
import type { OptionsWithUri } from 'request-promise-native';
|
||||
|
||||
@@ -25,7 +34,6 @@ import {
|
||||
replaceNullValues,
|
||||
sanitizeUiMessage,
|
||||
} from '../GenericFunctions';
|
||||
import { keysToLowercase } from '@utils/utilities';
|
||||
|
||||
function toText<T>(data: T) {
|
||||
if (typeof data === 'object' && data !== null) {
|
||||
@@ -1428,6 +1436,7 @@ export class HttpRequestV3 implements INodeType {
|
||||
}
|
||||
throw new NodeApiError(this.getNode(), response as JsonObject, { itemIndex });
|
||||
} else {
|
||||
removeCircularRefs(response.reason as JsonObject);
|
||||
// Return the actual reason as error
|
||||
returnItems.push({
|
||||
json: {
|
||||
|
||||
Reference in New Issue
Block a user