mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Automatically parse response in GraphQL node to JSON
This commit is contained in:
@@ -221,12 +221,16 @@ export class GraphQL implements INodeType {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (typeof response === 'string') {
|
if (typeof response === 'string') {
|
||||||
|
try {
|
||||||
|
returnItems.push({ json: JSON.parse(response) });
|
||||||
|
} catch (e) {
|
||||||
throw new Error('Response body is not valid JSON. Change "Response Format" to "String"');
|
throw new Error('Response body is not valid JSON. Change "Response Format" to "String"');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
returnItems.push({ json: response });
|
returnItems.push({ json: response });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return this.prepareOutputData(returnItems);
|
return this.prepareOutputData(returnItems);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user