mirror of
https://github.com/n8n-io/n8n.git
synced 2026-06-01 01:07:04 +02:00
In a rare edge case an undefined queue could be returned - this should not happen and now an error is thrown. Also using the opportunity to remove a cyclic dependency from the Queue.
19 lines
507 B
TypeScript
19 lines
507 B
TypeScript
import { BINARY_ENCODING, type IDataObject, type IExecuteResponsePromiseData } from 'n8n-workflow';
|
|
|
|
export function decodeWebhookResponse(
|
|
response: IExecuteResponsePromiseData,
|
|
): IExecuteResponsePromiseData {
|
|
if (
|
|
typeof response === 'object' &&
|
|
typeof response.body === 'object' &&
|
|
(response.body as IDataObject)['__@N8nEncodedBuffer@__']
|
|
) {
|
|
response.body = Buffer.from(
|
|
(response.body as IDataObject)['__@N8nEncodedBuffer@__'] as string,
|
|
BINARY_ENCODING,
|
|
);
|
|
}
|
|
|
|
return response;
|
|
}
|