mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-15 20:01:28 +00:00
Merge pull request #4969 from lohxt1/send_request_default_options
add explicit HTTP agents with keepAlive to `bru.sendRequest` axios request config
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