mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(HTTP Request Node): Process text files (#16226)
This commit is contained in:
@@ -27,6 +27,8 @@ import type { Readable } from 'stream';
|
||||
import { keysToLowercase } from '@utils/utilities';
|
||||
|
||||
import { mainProperties } from './Description';
|
||||
import { setFilename } from './utils/binaryData';
|
||||
import { mimeTypeFromResponse } from './utils/parse';
|
||||
import type { BodyParameter, IAuthDataSanitizeKeys } from '../GenericFunctions';
|
||||
import {
|
||||
binaryContentTypes,
|
||||
@@ -123,6 +125,8 @@ export class HttpRequestV3 implements INodeType {
|
||||
|
||||
let autoDetectResponseFormat = false;
|
||||
|
||||
let responseFileName: string | undefined;
|
||||
|
||||
// Can not be defined on a per item level
|
||||
const pagination = this.getNodeParameter('options.pagination.pagination', 0, null, {
|
||||
rawExpressions: true,
|
||||
@@ -240,12 +244,19 @@ export class HttpRequestV3 implements INodeType {
|
||||
allowUnauthorizedCerts: boolean;
|
||||
queryParameterArrays: 'indices' | 'brackets' | 'repeat';
|
||||
response: {
|
||||
response: { neverError: boolean; responseFormat: string; fullResponse: boolean };
|
||||
response: {
|
||||
neverError: boolean;
|
||||
responseFormat: string;
|
||||
fullResponse: boolean;
|
||||
outputPropertyName: string;
|
||||
};
|
||||
};
|
||||
redirect: { redirect: { maxRedirects: number; followRedirects: boolean } };
|
||||
lowercaseHeaders: boolean;
|
||||
};
|
||||
|
||||
responseFileName = response?.response?.outputPropertyName;
|
||||
|
||||
const url = this.getNodeParameter('url', itemIndex) as string;
|
||||
|
||||
const responseFormat = response?.response?.responseFormat || 'autodetect';
|
||||
@@ -904,17 +915,14 @@ export class HttpRequestV3 implements INodeType {
|
||||
const preparedBinaryData = await this.helpers.prepareBinaryData(
|
||||
binaryData,
|
||||
undefined,
|
||||
responseContentType || undefined,
|
||||
mimeTypeFromResponse(responseContentType),
|
||||
);
|
||||
|
||||
if (
|
||||
!preparedBinaryData.fileName &&
|
||||
preparedBinaryData.fileExtension &&
|
||||
typeof requestOptions.uri === 'string' &&
|
||||
requestOptions.uri.endsWith(preparedBinaryData.fileExtension)
|
||||
) {
|
||||
preparedBinaryData.fileName = requestOptions.uri.split('/').pop();
|
||||
}
|
||||
preparedBinaryData.fileName = setFilename(
|
||||
preparedBinaryData,
|
||||
requestOptions,
|
||||
responseFileName,
|
||||
);
|
||||
|
||||
newItem.binary![outputPropertyName] = preparedBinaryData;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user