mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 08:34:07 -08:00
feat(core): Make all http requests made with httpRequestWithAuthentication
abortable (#11704)
This commit is contained in:
parent
3202e8c946
commit
0d8aada490
|
@ -918,6 +918,10 @@ function convertN8nRequestToAxios(n8nRequest: IHttpRequestOptions): AxiosRequest
|
||||||
|
|
||||||
axiosRequest.params = n8nRequest.qs;
|
axiosRequest.params = n8nRequest.qs;
|
||||||
|
|
||||||
|
if (n8nRequest.abortSignal) {
|
||||||
|
axiosRequest.signal = n8nRequest.abortSignal;
|
||||||
|
}
|
||||||
|
|
||||||
if (n8nRequest.baseURL !== undefined) {
|
if (n8nRequest.baseURL !== undefined) {
|
||||||
axiosRequest.baseURL = n8nRequest.baseURL;
|
axiosRequest.baseURL = n8nRequest.baseURL;
|
||||||
}
|
}
|
||||||
|
@ -1718,6 +1722,11 @@ export async function httpRequestWithAuthentication(
|
||||||
) {
|
) {
|
||||||
removeEmptyBody(requestOptions);
|
removeEmptyBody(requestOptions);
|
||||||
|
|
||||||
|
// Cancel this request on execution cancellation
|
||||||
|
if ('getExecutionCancelSignal' in this) {
|
||||||
|
requestOptions.abortSignal = this.getExecutionCancelSignal();
|
||||||
|
}
|
||||||
|
|
||||||
let credentialsDecrypted: ICredentialDataDecryptedObject | undefined;
|
let credentialsDecrypted: ICredentialDataDecryptedObject | undefined;
|
||||||
try {
|
try {
|
||||||
const parentTypes = additionalData.credentialsHelper.getParentTypes(credentialsType);
|
const parentTypes = additionalData.credentialsHelper.getParentTypes(credentialsType);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
|
||||||
import type { CallbackManager as CallbackManagerLC } from '@langchain/core/callbacks/manager';
|
import type { CallbackManager as CallbackManagerLC } from '@langchain/core/callbacks/manager';
|
||||||
import type { AxiosProxyConfig } from 'axios';
|
import type { AxiosProxyConfig, GenericAbortSignal } from 'axios';
|
||||||
import type * as express from 'express';
|
import type * as express from 'express';
|
||||||
import type FormData from 'form-data';
|
import type FormData from 'form-data';
|
||||||
import type { PathLike } from 'fs';
|
import type { PathLike } from 'fs';
|
||||||
|
@ -529,6 +529,7 @@ export interface IHttpRequestOptions {
|
||||||
};
|
};
|
||||||
timeout?: number;
|
timeout?: number;
|
||||||
json?: boolean;
|
json?: boolean;
|
||||||
|
abortSignal?: GenericAbortSignal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue