mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(HTTP Request Node): Move from Binary Buffer to Binary streaming (#5610)
* ✨ Change from binary buffer to binary streaming * Remove console.logs * Import Readable from the correct lib * stream response * parametersToKeyValue doesn't need to be async anymore * Fix bodyParameter reduce method * parametersToKeyValue doesn't need to be async anymore * handle streaming responses * send `Content-Length` and `Content-Type` on binary requests * Add new helper function for binary data * Add binary function to helpers interface * Fix bug in error handler * Fix issue with wrongfully assigned headers to body * Fix test workflow * Remove console.logs * Remove unnecsessary type * Remove concat dependency already imported in workflow package * Update pnpm-lock file * Small fixes, asyncronous error message * reset the lockfile * Remove buffer check and simplify error handling --------- Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -108,6 +108,7 @@ import type { IResponseError, IWorkflowSettings } from './Interfaces';
|
||||
import { extractValue } from './ExtractValue';
|
||||
import { getClientCredentialsToken } from './OAuth2Helper';
|
||||
import { PLACEHOLDER_EMPTY_EXECUTION_ID } from './Constants';
|
||||
import { binaryToBuffer } from './BinaryDataManager/utils';
|
||||
|
||||
axios.defaults.timeout = 300000;
|
||||
// Prevent axios from adding x-form-www-urlencoded headers by default
|
||||
@@ -686,9 +687,7 @@ async function proxyRequestToAxios(
|
||||
if (response) {
|
||||
Logger.debug('Request proxied to Axios failed', { status: response.status });
|
||||
let responseData = response.data;
|
||||
if (Buffer.isBuffer(responseData)) {
|
||||
responseData = responseData.toString('utf-8');
|
||||
}
|
||||
responseData = await binaryToBuffer(responseData);
|
||||
error.message = `${response.status as number} - ${JSON.stringify(responseData)}`;
|
||||
}
|
||||
|
||||
@@ -2055,6 +2054,7 @@ const getBinaryHelperFunctions = ({
|
||||
}: IWorkflowExecuteAdditionalData): BinaryHelperFunctions => ({
|
||||
getBinaryStream,
|
||||
getBinaryMetadata,
|
||||
binaryToBuffer,
|
||||
prepareBinaryData: async (binaryData, filePath, mimeType) =>
|
||||
prepareBinaryData(binaryData, executionId!, filePath, mimeType),
|
||||
setBinaryDataBuffer: async (data, binaryData) =>
|
||||
@@ -2313,6 +2313,7 @@ export function getExecuteFunctions(
|
||||
return dataProxy.getDataProxy();
|
||||
},
|
||||
prepareOutputData: NodeHelpers.prepareOutputData,
|
||||
binaryToBuffer,
|
||||
async putExecutionToWait(waitTill: Date): Promise<void> {
|
||||
runExecutionData.waitTill = waitTill;
|
||||
if (additionalData.setExecutionStatus) {
|
||||
|
||||
Reference in New Issue
Block a user