mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -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) {
|
if (this.sessionId === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,7 +137,7 @@ export class WorkflowRunnerProcess {
|
||||||
const additionalData = await WorkflowExecuteAdditionalData.getBase(this.data.credentials, undefined, workflowTimeout <= 0 ? undefined : Date.now() + workflowTimeout * 1000);
|
const additionalData = await WorkflowExecuteAdditionalData.getBase(this.data.credentials, undefined, workflowTimeout <= 0 ? undefined : Date.now() + workflowTimeout * 1000);
|
||||||
additionalData.hooks = this.getProcessForwardHooks();
|
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') {
|
if (workflowRunner.data!.executionMode !== 'manual') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -749,7 +749,7 @@ export function getExecuteFunctions(workflow: Workflow, runExecutionData: IRunEx
|
||||||
return workflow.getStaticData(type, node);
|
return workflow.getStaticData(type, node);
|
||||||
},
|
},
|
||||||
prepareOutputData: NodeHelpers.prepareOutputData,
|
prepareOutputData: NodeHelpers.prepareOutputData,
|
||||||
sendMessageToUI(message: string): void {
|
sendMessageToUI(message: any): void { // tslint:disable-line:no-any
|
||||||
if (mode !== 'manual') {
|
if (mode !== 'manual') {
|
||||||
return;
|
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
|
// Now that the options are all set make the actual http request
|
||||||
if (oAuth1Api !== undefined) {
|
if (oAuth1Api !== undefined) {
|
||||||
requestPromises.push(this.helpers.requestOAuth1.call(this, 'oAuth1Api', requestOptions));
|
requestPromises.push(this.helpers.requestOAuth1.call(this, 'oAuth1Api', requestOptions));
|
||||||
|
|
|
@ -223,7 +223,7 @@ export interface IExecuteFunctions {
|
||||||
getTimezone(): string;
|
getTimezone(): string;
|
||||||
getWorkflow(): IWorkflowMetadata;
|
getWorkflow(): IWorkflowMetadata;
|
||||||
prepareOutputData(outputData: INodeExecutionData[], outputIndex?: number): Promise<INodeExecutionData[][]>;
|
prepareOutputData(outputData: INodeExecutionData[], outputIndex?: number): Promise<INodeExecutionData[][]>;
|
||||||
sendMessageToUI(message: string): void;
|
sendMessageToUI(message: any): void; // tslint:disable-line:no-any
|
||||||
helpers: {
|
helpers: {
|
||||||
[key: string]: (...args: any[]) => any //tslint:disable-line:no-any
|
[key: string]: (...args: any[]) => any //tslint:disable-line:no-any
|
||||||
};
|
};
|
||||||
|
@ -745,7 +745,7 @@ export interface IWorkflowExecuteAdditionalData {
|
||||||
httpResponse?: express.Response;
|
httpResponse?: express.Response;
|
||||||
httpRequest?: express.Request;
|
httpRequest?: express.Request;
|
||||||
restApiUrl: string;
|
restApiUrl: string;
|
||||||
sendMessageToUI?: (source: string, message: string) => void;
|
sendMessageToUI?: (source: string, message: any) => void; // tslint:disable-line:no-any
|
||||||
timezone: string;
|
timezone: string;
|
||||||
webhookBaseUrl: string;
|
webhookBaseUrl: string;
|
||||||
webhookTestBaseUrl: string;
|
webhookTestBaseUrl: string;
|
||||||
|
|
Loading…
Reference in a new issue