mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-23 04:35:40 +00:00
add explicit HTTP agents with keepAlive to bru.sendRequest axios instance
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { default as axios, AxiosRequestConfig, AxiosRequestHeaders, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
|
||||
import http from 'node:http';
|
||||
import https from 'node:https';
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -25,6 +27,8 @@ type ModifiedAxiosResponse = AxiosResponse & {
|
||||
}
|
||||
|
||||
const baseRequestConfig: Partial<AxiosRequestConfig> = {
|
||||
httpAgent: new http.Agent({ keepAlive: true }),
|
||||
httpsAgent: new https.Agent({ keepAlive: true }),
|
||||
transformRequest: function transformRequest(data: any, headers: AxiosRequestHeaders) {
|
||||
const contentType = headers.getContentType() || '';
|
||||
const hasJSONContentType = contentType.includes('json');
|
||||
|
||||
Reference in New Issue
Block a user