mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
⚡ Automatically parse response in GraphQL node to JSON
This commit is contained in:
parent
8acc3c5931
commit
108ffb0d86
|
@ -221,10 +221,14 @@ export class GraphQL implements INodeType {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (typeof response === 'string') {
|
if (typeof response === 'string') {
|
||||||
throw new Error('Response body is not valid JSON. Change "Response Format" to "String"');
|
try {
|
||||||
|
returnItems.push({ json: JSON.parse(response) });
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error('Response body is not valid JSON. Change "Response Format" to "String"');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
returnItems.push({ json: response });
|
||||||
}
|
}
|
||||||
|
|
||||||
returnItems.push({ json: response });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue