-
Notifications
You must be signed in to change notification settings - Fork 38
/
httpClientProvider.ts
28 lines (24 loc) · 974 Bytes
/
httpClientProvider.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { HttpRegion } from './httpRegion';
import { HttpRequest, Request } from './httpRequest';
import { HttpResponse } from './httpResponse';
import { RequestLogger } from './logHandler';
import { ProcessorContext, Progress } from './processorContext';
import { RepeatOptions } from './repeatOptions';
import { RequestClient } from './requestClient';
export interface HttpClientContext {
progress?: Progress | undefined;
isMainContext?: boolean;
repeat?: RepeatOptions;
httpRegion?: HttpRegion;
logResponse?: RequestLogger;
config?: {
request?: Record<string, unknown>;
proxy?: string;
};
}
export type HttpClientRequest = Partial<HttpRequest> & Omit<HttpRequest, 'protocol'>;
export type HttpClient = (request: HttpClientRequest, context: HttpClientContext) => Promise<HttpResponse | false>;
export interface HttpClientProvider {
createRequestClient?: (request: Request, context: ProcessorContext) => RequestClient;
exchange?: HttpClient;
}