@vercel/queue 0.0.0-alpha.35 → 0.0.0-alpha.36

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
@@ -568,13 +568,30 @@ var QueueClient = class {
568
568
  payload,
569
569
  idempotencyKey,
570
570
  retentionSeconds,
571
- delaySeconds
571
+ delaySeconds,
572
+ headers: optionHeaders
572
573
  } = options;
573
- const headers = new Headers({
574
- Authorization: `Bearer ${await this.getToken()}`,
575
- "Content-Type": transport.contentType,
576
- ...this.customHeaders
577
- });
574
+ const headers = new Headers();
575
+ if (this.customHeaders) {
576
+ for (const [name, value] of Object.entries(this.customHeaders)) {
577
+ headers.append(name, value);
578
+ }
579
+ }
580
+ if (optionHeaders) {
581
+ const protectedHeaderNames = /* @__PURE__ */ new Set(["authorization", "content-type"]);
582
+ const isProtectedHeader = (name) => {
583
+ const lower = name.toLowerCase();
584
+ if (protectedHeaderNames.has(lower)) return true;
585
+ return lower.startsWith("vqs-");
586
+ };
587
+ for (const [name, value] of Object.entries(optionHeaders)) {
588
+ if (!isProtectedHeader(name) && value !== void 0) {
589
+ headers.append(name, value);
590
+ }
591
+ }
592
+ }
593
+ headers.set("Authorization", `Bearer ${await this.getToken()}`);
594
+ headers.set("Content-Type", transport.contentType);
578
595
  const deploymentId = this.getSendDeploymentId();
579
596
  if (deploymentId) {
580
597
  headers.set("Vqs-Deployment-Id", deploymentId);
@@ -1221,7 +1238,8 @@ var Topic = class {
1221
1238
  payload,
1222
1239
  idempotencyKey: options?.idempotencyKey,
1223
1240
  retentionSeconds: options?.retentionSeconds,
1224
- delaySeconds: options?.delaySeconds
1241
+ delaySeconds: options?.delaySeconds,
1242
+ headers: options?.headers
1225
1243
  },
1226
1244
  this.transport
1227
1245
  );
@@ -1404,7 +1422,8 @@ async function send(topicName, payload, options) {
1404
1422
  payload,
1405
1423
  idempotencyKey: options?.idempotencyKey,
1406
1424
  retentionSeconds: options?.retentionSeconds,
1407
- delaySeconds: options?.delaySeconds
1425
+ delaySeconds: options?.delaySeconds,
1426
+ headers: options?.headers
1408
1427
  },
1409
1428
  transport
1410
1429
  );