MCPcopy Create free account
hub / github.com/ProtonDriveApps/sdk / HTTPClient

Class HTTPClient

cli/src/api/httpClient.ts:5–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import { ApiClient } from 'proton-drive-sdk-account';
4
5export class HTTPClient {
6 constructor(private readonly apiClient: ApiClient) {}
7
8 async fetchJson(options: ProtonDriveHTTPClientJsonRequest): Promise<Response> {
9 return this.apiClient.authenticatedRequest(options.url, {
10 method: options.method,
11 ...(options.json !== undefined ? { json: options.json } : {}),
12 ...(options.body !== undefined && options.json === undefined ? { body: options.body } : {}),
13 headers: options.headers,
14 timeout: options.timeoutMs,
15 signal: options.signal,
16 throwHttpErrors: false,
17 });
18 }
19
20 async fetchBlob(options: ProtonDriveHTTPClientBlobRequest): Promise<Response> {
21 return this.apiClient.authenticatedRequest(options.url, {
22 method: options.method,
23 body: options.body,
24 headers: options.headers,
25 timeout: options.timeoutMs,
26 signal: options.signal,
27 throwHttpErrors: false,
28 });
29 }
30}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected