import { ObjectId } from "bson" ; import http from "http" ; import https from "https" ; import { BaseHttpClient , BaseHttpClientOptions , defaultBaseHttpClientOptions } from "tsrpc-base-client" ; import { BaseServiceType , ServiceProto } from "tsrpc-proto" ; import { HttpProxy } from "./HttpProxy" ; typeParam export class HttpClient < ServiceType extends BaseServiceType > extends BaseHttpClient < ServiceType > { readonly options ! : Readonly < HttpClientOptions > ; constructor ( proto , options ? ) { let httpProxy = new HttpProxy ; super ( proto , httpProxy , { customObjectIdClass : ObjectId , ... defaultHttpClientOptions , ... options } ) ; httpProxy . agent = this . options . agent ; } } const defaultHttpClientOptions = { ... defaultBaseHttpClientOptions } ; export interface HttpClientOptions extends BaseHttpClientOptions { /** NodeJS HTTP Agent */ agent ? : http . Agent | https . Agent ; }