🐛 Fix bug with responseFormat "file" for POST-Requests

This commit is contained in:
Jan Oberhauser 2020-10-19 09:42:04 +02:00
parent e272c69f07
commit 4165fad307

View file

@ -772,6 +772,19 @@ export class HttpRequest implements INodeType {
}
}
if (responseFormat === 'file') {
requestOptions.encoding = null;
requestOptions.body = JSON.stringify(requestOptions.body);
if (requestOptions.headers === undefined) {
requestOptions.headers = {};
}
requestOptions.headers['Content-Type'] = 'application/json';
} else if (options.bodyContentType === 'raw') {
requestOptions.json = false;
} else {
requestOptions.json = true;
}
// Add Content Type if any are set
if (options.bodyContentCustomMimeType) {
if(requestOptions.headers === undefined) {
@ -808,14 +821,6 @@ export class HttpRequest implements INodeType {
}
}
if (responseFormat === 'file') {
requestOptions.encoding = null;
} else if(options.bodyContentType === 'raw') {
requestOptions.json = false;
} else {
requestOptions.json = true;
}
// Now that the options are all set make the actual http request
if (oAuth1Api !== undefined) {
requestPromises.push(this.helpers.requestOAuth1.call(this, 'oAuth1Api', requestOptions));