We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 21fe6ee commit 79b7da8Copy full SHA for 79b7da8
1 file changed
src/client.ts
@@ -260,6 +260,18 @@ export class ImageKit {
260
this.fetch = options.fetch ?? Shims.getDefaultFetch();
261
this.#encoder = Opts.FallbackEncoder;
262
263
+ const customHeadersEnv = readEnv('IMAGE_KIT_CUSTOM_HEADERS');
264
+ if (customHeadersEnv) {
265
+ const parsed: Record<string, string> = {};
266
+ for (const line of customHeadersEnv.split('\n')) {
267
+ const colon = line.indexOf(':');
268
+ if (colon >= 0) {
269
+ parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
270
+ }
271
272
+ options.defaultHeaders = { ...parsed, ...options.defaultHeaders };
273
274
+
275
this._options = options;
276
277
this.privateKey = privateKey;
0 commit comments