Method
constructor
(config: ClientConfig = {})
Source from the content-addressed store, hash-verified
| 36 | private baseUrl: string; |
| 37 | |
| 38 | constructor(config: ClientConfig = {}) { |
| 39 | this.baseUrl = config.baseUrl || 'http://localhost:3211'; |
| 40 | |
| 41 | this.client = createClient<paths>({ |
| 42 | baseUrl: this.baseUrl, |
| 43 | headers: { |
| 44 | 'Content-Type': 'application/json', |
| 45 | ...config.headers, |
| 46 | }, |
| 47 | }); |
| 48 | |
| 49 | if (config.middleware) { |
| 50 | const middlewares = Array.isArray(config.middleware) |
| 51 | ? config.middleware |
| 52 | : [config.middleware]; |
| 53 | for (const mw of middlewares) { |
| 54 | this.client.use(mw); |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | getBaseUrl(): string { |
| 60 | return this.baseUrl; |
Callers
nothing calls this directly
Tested by
no test coverage detected