@niledatabase/server 5.0.0-alpha.6 → 5.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2857,17 +2857,22 @@ function bindHandleOnRequest(instance) {
2857
2857
  }
2858
2858
  const ext = await create2(instance);
2859
2859
  if (ext.onRequest) {
2860
- const modified = await ext.onRequest(_init.request);
2861
- if (modified?.headers) {
2862
- const modHeaders = new Headers(modified.headers);
2863
- const cookie = modHeaders.get("cookie");
2860
+ await ext.onRequest(_init.request);
2861
+ const updatedContext = instance.getContext();
2862
+ if (updatedContext?.headers) {
2863
+ const cookie = updatedContext.headers.get("cookie");
2864
2864
  if (cookie) {
2865
2865
  params.headers.set("cookie", cookie);
2866
- debug(`${ext.id ?? create2.name} modified cookie`);
2866
+ }
2867
+ if (updatedContext.tenantId) {
2868
+ params.headers.set(
2869
+ TENANT_COOKIE,
2870
+ String(updatedContext.headers.get(TENANT_COOKIE))
2871
+ );
2867
2872
  }
2868
2873
  }
2874
+ debug(`${ext.id ?? create2.name} ran onRequest`);
2869
2875
  }
2870
- debug(`${ext.id ?? create2.name} ran onRequest`);
2871
2876
  }
2872
2877
  }
2873
2878
  };
@@ -3045,6 +3050,7 @@ var Server = class {
3045
3050
  for (const [key17, value] of Object.entries(merged)) {
3046
3051
  this.#headers.set(key17, value);
3047
3052
  }
3053
+ this.#config.logger("[handleHeaders]").debug(JSON.stringify(merged));
3048
3054
  this.#config.headers = this.#headers;
3049
3055
  }
3050
3056
  /**