mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-23 11:44:06 -08:00
✨ Send request of HTTP Request node to browser console when testing
This commit is contained in:
parent
21633b0c5a
commit
1d850da9fb
|
@ -656,7 +656,7 @@ export async function executeWorkflow(workflowInfo: IExecuteWorkflowInfo, additi
|
|||
}
|
||||
|
||||
|
||||
export function sendMessageToUI(source: string, message: string) {
|
||||
export function sendMessageToUI(source: string, message: any) { // tslint:disable-line:no-any
|
||||
if (this.sessionId === undefined) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ export class WorkflowRunnerProcess {
|
|||
const additionalData = await WorkflowExecuteAdditionalData.getBase(this.data.credentials, undefined, workflowTimeout <= 0 ? undefined : Date.now() + workflowTimeout * 1000);
|
||||
additionalData.hooks = this.getProcessForwardHooks();
|
||||
|
||||
additionalData.sendMessageToUI = async (source: string, message: string) => {
|
||||
additionalData.sendMessageToUI = async (source: string, message: any) => { // tslint:disable-line:no-any
|
||||
if (workflowRunner.data!.executionMode !== 'manual') {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -749,7 +749,7 @@ export function getExecuteFunctions(workflow: Workflow, runExecutionData: IRunEx
|
|||
return workflow.getStaticData(type, node);
|
||||
},
|
||||
prepareOutputData: NodeHelpers.prepareOutputData,
|
||||
sendMessageToUI(message: string): void {
|
||||
sendMessageToUI(message: any): void { // tslint:disable-line:no-any
|
||||
if (mode !== 'manual') {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -867,6 +867,18 @@ export class HttpRequest implements INodeType {
|
|||
}
|
||||
}
|
||||
|
||||
try {
|
||||
let sendRequest: any = requestOptions; // eslint-disable-line:no-any
|
||||
// Protect browser from sending large binary data
|
||||
if (Buffer.isBuffer(sendRequest.body) && sendRequest.body.length > 250000) {
|
||||
sendRequest = {
|
||||
...requestOptions,
|
||||
body: `Binary data got replaced with this text. Original was a Buffer with a size of ${requestOptions.body.length} byte.`,
|
||||
};
|
||||
}
|
||||
this.sendMessageToUI(sendRequest);
|
||||
} catch (e) {};
|
||||
|
||||
// Now that the options are all set make the actual http request
|
||||
if (oAuth1Api !== undefined) {
|
||||
requestPromises.push(this.helpers.requestOAuth1.call(this, 'oAuth1Api', requestOptions));
|
||||
|
|
|
@ -223,7 +223,7 @@ export interface IExecuteFunctions {
|
|||
getTimezone(): string;
|
||||
getWorkflow(): IWorkflowMetadata;
|
||||
prepareOutputData(outputData: INodeExecutionData[], outputIndex?: number): Promise<INodeExecutionData[][]>;
|
||||
sendMessageToUI(message: string): void;
|
||||
sendMessageToUI(message: any): void; // tslint:disable-line:no-any
|
||||
helpers: {
|
||||
[key: string]: (...args: any[]) => any //tslint:disable-line:no-any
|
||||
};
|
||||
|
@ -745,7 +745,7 @@ export interface IWorkflowExecuteAdditionalData {
|
|||
httpResponse?: express.Response;
|
||||
httpRequest?: express.Request;
|
||||
restApiUrl: string;
|
||||
sendMessageToUI?: (source: string, message: string) => void;
|
||||
sendMessageToUI?: (source: string, message: any) => void; // tslint:disable-line:no-any
|
||||
timezone: string;
|
||||
webhookBaseUrl: string;
|
||||
webhookTestBaseUrl: string;
|
||||
|
|
Loading…
Reference in a new issue