mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
cleanup
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
9aa5b5d875
commit
a0e992a3ea
@ -56,6 +56,10 @@ export interface JsonApiConfig {
|
||||
debug?: boolean;
|
||||
getRequestOptions?: () => Promise<RequestInit>;
|
||||
}
|
||||
|
||||
const httpAgent = new HttpAgent({ keepAlive: true });
|
||||
const httpsAgent = new HttpsAgent({ keepAlive: true });
|
||||
|
||||
export class JsonApi<D = JsonApiData, P extends JsonApiParams = JsonApiParams> {
|
||||
static reqInitDefault: RequestInit = {
|
||||
headers: {
|
||||
@ -98,9 +102,7 @@ export class JsonApi<D = JsonApiData, P extends JsonApiParams = JsonApiParams> {
|
||||
}
|
||||
|
||||
if (!reqInit.agent) {
|
||||
const agentOpts = { keepAlive: true };
|
||||
|
||||
reqInit.agent = reqUrl.startsWith("https:") ? new HttpsAgent(agentOpts) : new HttpAgent(agentOpts);
|
||||
reqInit.agent = reqUrl.startsWith("https:") ? httpsAgent : httpAgent;
|
||||
}
|
||||
|
||||
if (query) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user