MCPcopy
hub / github.com/tsrpc/tsrpc / constructor

Method constructor

src/client/http/HttpClient.ts:24–33  ·  view source on GitHub ↗
(options?: Partial<HttpClientOptions<ServiceType>>)

Source from the content-addressed store, hash-verified

22 lastReceivedBuf?: Uint8Array;
23
24 constructor(options?: Partial<HttpClientOptions<ServiceType>>) {
25 this._options = Object.assign({}, defaultHttpClientOptions, options);
26 this.serviceMap = ServiceMapUtil.getServiceMap(this._options.proto);
27 this.tsbuffer = new TSBuffer(this._options.proto.types);
28 this.logger = this._options.logger;
29
30 this._http = this._options.server.startsWith('https://') ? https : http;
31
32 this.logger.log('TSRPC HTTP Client :', this._options.server);
33 }
34
35 callApi<T extends keyof ServiceType['req']>(apiName: T, req: ServiceType['req'][T], options: TransportOptions = {}): SuperPromise<ServiceType['res'][T], TsrpcError> {
36 let sn = this._snCounter.getNext();

Callers

nothing calls this directly

Calls 2

getServiceMapMethod · 0.80
logMethod · 0.65

Tested by

no test coverage detected