There was an error while loading. Please reload this page.
1 parent fbbc840 commit ffa9adbCopy full SHA for ffa9adb
1 file changed
src/client.ts
@@ -241,6 +241,18 @@ export class Finch {
241
this.fetch = options.fetch ?? Shims.getDefaultFetch();
242
this.#encoder = Opts.FallbackEncoder;
243
244
+ const customHeadersEnv = readEnv('FINCH_CUSTOM_HEADERS');
245
+ if (customHeadersEnv) {
246
+ const parsed: Record<string, string> = {};
247
+ for (const line of customHeadersEnv.split('\n')) {
248
+ const colon = line.indexOf(':');
249
+ if (colon >= 0) {
250
+ parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
251
+ }
252
253
+ options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
254
255
+
256
this._options = options;
257
258
this.accessToken = accessToken;
0 commit comments