mirror of
https://github.com/graphql-hive/console
synced 2026-05-23 17:18:23 +00:00
Allow to pass http and https agents (#3263)
This commit is contained in:
parent
5f5294c419
commit
7924ddcd30
2 changed files with 17 additions and 0 deletions
5
.changeset/light-guests-dress.md
Normal file
5
.changeset/light-guests-dress.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@graphql-hive/client': minor
|
||||
---
|
||||
|
||||
Allow to pass http and https agents
|
||||
|
|
@ -42,6 +42,14 @@ export interface AgentOptions {
|
|||
* Custom logger (defaults to console)
|
||||
*/
|
||||
logger?: Logger;
|
||||
/**
|
||||
* Define a custom http agent to be used when performing http requests
|
||||
*/
|
||||
httpAgent?: any;
|
||||
/**
|
||||
* Define a custom https agent to be used when performing https requests
|
||||
*/
|
||||
httpsAgent?: any;
|
||||
}
|
||||
|
||||
export function createAgent<TEvent, TResult = void>(
|
||||
|
|
@ -72,6 +80,8 @@ export function createAgent<TEvent, TResult = void>(
|
|||
maxSize: 25,
|
||||
logger: console,
|
||||
name: 'hive-client',
|
||||
httpAgent: undefined,
|
||||
httpsAgent: undefined,
|
||||
...pluginOptions,
|
||||
};
|
||||
|
||||
|
|
@ -168,6 +178,8 @@ export function createAgent<TEvent, TResult = void>(
|
|||
},
|
||||
responseType: 'json',
|
||||
timeout: options.timeout,
|
||||
httpAgent: options.httpAgent,
|
||||
httpsAgent: options.httpsAgent,
|
||||
})
|
||||
.catch(error => {
|
||||
debugLog(`Attempt ${attempt} failed: ${error.message}`);
|
||||
|
|
|
|||
Loading…
Reference in a new issue