We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 38bf722 commit 70285d6Copy full SHA for 70285d6
1 file changed
src/client.ts
@@ -191,6 +191,18 @@ export class OzAPI {
191
this.fetch = options.fetch ?? Shims.getDefaultFetch();
192
this.#encoder = Opts.FallbackEncoder;
193
194
+ const customHeadersEnv = readEnv('OZ_API_CUSTOM_HEADERS');
195
+ if (customHeadersEnv) {
196
+ const parsed: Record<string, string> = {};
197
+ for (const line of customHeadersEnv.split('\n')) {
198
+ const colon = line.indexOf(':');
199
+ if (colon >= 0) {
200
+ parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
201
+ }
202
203
+ options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
204
205
+
206
this._options = options;
207
208
this.apiKey = apiKey;
0 commit comments