File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
packages/service-utils/src/cf-worker Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 1- import type { Request } from "@cloudflare/workers-types" ;
1+ import { Headers , type Request , fetch } from "@cloudflare/workers-types" ;
22import type { CoreAuthInput } from "src/core/types.js" ;
33import type {
44 ClientUsageV2Event ,
@@ -32,14 +32,12 @@ export async function sendUsageV2Events<T extends UsageV2Options>(
3232 // Forward headers from the origin request.
3333 // Determine endpoint and auth header based on provided credentials.
3434 let url : string ;
35- const headers : HeadersInit = {
36- ...authInput . req . headers ,
37- "Content-Type" : "application/json" ,
38- } ;
35+ const headers = new Headers ( authInput . req . headers ) ;
36+ headers . set ( "Content-Type" , "application/json" ) ;
3937 if ( serviceKey ) {
4038 // If a service key is provided, call the non-public usage endpoint.
4139 url = `${ usageBaseUrl } /usage-v2/${ source } ` ;
42- headers [ "x-service-api-key" ] = serviceKey ;
40+ headers . set ( "x-service-api-key" , serviceKey ) ;
4341 } else {
4442 url = `${ usageBaseUrl } /usage-v2/${ source } /client` ;
4543 }
You can’t perform that action at this time.
0 commit comments