Skip to content

Commit

Permalink
shallow copy headers without importing cf worker
Browse files Browse the repository at this point in the history
  • Loading branch information
arcoraven committed Mar 4, 2025
1 parent 2657776 commit 915415b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/service-utils/src/cf-worker/usageV2.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { Request } from "@cloudflare/workers-types";
import type { CoreAuthInput } from "../core/types.js";
import type {
ClientUsageV2Event,
Expand Down Expand Up @@ -33,7 +34,7 @@ export async function sendUsageV2Events<T extends UsageV2Options>(
// Forward headers from the origin request.
// Determine endpoint and auth header based on provided credentials.
let url: string;
const headers = new Headers(authInput.req.headers);
const headers = new Headers(Object.fromEntries(authInput.req.headers));
headers.set("Content-Type", "application/json");
if (serviceKey) {
// If a service key is provided, call the non-public usage endpoint.
Expand Down

0 comments on commit 915415b

Please sign in to comment.