@niledatabase/server 5.3.1-alpha.2 → 5.3.1-alpha.3

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
@@ -548,7 +548,9 @@ async function request(url, _init, config) {
548
548
  process.env.NODE_ENV === "production" ? "true" : "false"
549
549
  );
550
550
  }
551
- updatedHeaders.set("host", requestUrl.host);
551
+ if (config.skipHostHeader !== true) {
552
+ updatedHeaders.set("host", requestUrl.host);
553
+ }
552
554
  if (config.callbackUrl) {
553
555
  const cbUrl = new URL(config.callbackUrl);
554
556
  debug(`Obtained origin from config.callbackUrl ${config.callbackUrl}`);
@@ -2122,12 +2124,17 @@ var Config = class {
2122
2124
  * change the starting route
2123
2125
  */
2124
2126
  routePrefix;
2127
+ /**
2128
+ * Skip setting the host header in the request.
2129
+ */
2130
+ skipHostHeader;
2125
2131
  db;
2126
2132
  constructor(config) {
2127
2133
  this.routePrefix = config?.routePrefix ?? "/api";
2128
2134
  this.debug = config?.debug;
2129
2135
  this.origin = config?.origin;
2130
2136
  this.extensions = config?.extensions;
2137
+ this.skipHostHeader = config?.skipHostHeader;
2131
2138
  this.extensionCtx = config?.extensionCtx;
2132
2139
  this.serverOrigin = config?.origin ?? "http://localhost:3000";
2133
2140
  this.logger = Logger(config);
@@ -3728,6 +3735,9 @@ var Server = class {
3728
3735
  set paths(paths) {
3729
3736
  this.#config.paths = paths;
3730
3737
  }
3738
+ set skipHostHeader(value) {
3739
+ this.#config.skipHostHeader = value;
3740
+ }
3731
3741
  async withContext(contextOrFn, maybeFn) {
3732
3742
  const isFn = typeof contextOrFn === "function";
3733
3743
  const context = isFn ? {} : contextOrFn ?? {};