Send request of HTTP Request node to browser console when testing

This commit is contained in:
Jan Oberhauser 2021-06-12 20:22:55 +02:00
parent 21633b0c5a
commit 1d850da9fb
5 changed files with 17 additions and 5 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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));

View file

@ -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;