fix(HTTP Request Node): Correctly doesn't redirect on non GET method (#6132)

Fixed ingnored parameter for redirect
This commit is contained in:
agobrech
2023-05-04 09:55:35 +02:00
committed by GitHub
parent 5d77ec76e3
commit 3f5c606254
2 changed files with 8 additions and 4 deletions

View File

@@ -39,7 +39,7 @@ export class HttpRequestV3 implements INodeType {
this.description = {
...baseDescription,
subtitle: '={{$parameter["method"] + ": " + $parameter["url"]}}',
version: [3, 4],
version: [3, 4, 4.1],
defaults: {
name: 'HTTP Request',
color: '#2200DD',
@@ -1104,6 +1104,11 @@ export class HttpRequestV3 implements INodeType {
if (autoDetectResponseFormat || fullResponse) {
requestOptions.resolveWithFullResponse = true;
}
if (requestOptions.method !== 'GET' && nodeVersion >= 4.1) {
requestOptions = { ...requestOptions, followAllRedirects: false };
}
const defaultRedirect = nodeVersion >= 4 && redirect === undefined;
if (redirect?.redirect?.followRedirects || defaultRedirect) {
@@ -1129,7 +1134,6 @@ export class HttpRequestV3 implements INodeType {
// set default timeout to 1 hour
requestOptions.timeout = 3600000;
}
if (sendQuery && queryParameterArrays) {
Object.assign(requestOptions, {
qsStringifyOptions: { arrayFormat: queryParameterArrays },
@@ -1346,7 +1350,6 @@ export class HttpRequestV3 implements INodeType {
'application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7';
}
}
try {
this.sendMessageToUI(sanitizeUiMessage(requestOptions, authDataKeys));
} catch (e) {}