mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(HTTP Request Node): Ignore empty body for auto detect json (#5215)
This commit is contained in:
committed by
GitHub
parent
7954ed3cfb
commit
af703371fc
@@ -1344,7 +1344,17 @@ export class HttpRequestV3 implements INodeType {
|
||||
const responseContentType = response.headers['content-type'] ?? '';
|
||||
if (responseContentType.includes('application/json')) {
|
||||
responseFormat = 'json';
|
||||
response.body = jsonParse(Buffer.from(response.body).toString());
|
||||
const neverError = this.getNodeParameter(
|
||||
'options.response.response.neverError',
|
||||
0,
|
||||
false,
|
||||
) as boolean;
|
||||
const data = Buffer.from(response.body).toString();
|
||||
response.body = jsonParse(data, {
|
||||
...(neverError
|
||||
? { fallbackValue: {} }
|
||||
: { errorMessage: 'Invalid JSON in response body' }),
|
||||
});
|
||||
} else if (binaryContentTypes.some((e) => responseContentType.includes(e))) {
|
||||
responseFormat = 'file';
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user