@@ -173,10 +173,8 @@ describe("auth/oauth", () => {
173173 it ( "posts grant_type=refresh_token and persists the response" , async ( ) => {
174174 process . env [ "HEYGEN_API_URL" ] = "https://api.test.example" ;
175175 let capturedBody : string | undefined ;
176- let capturedHeaders : HeadersInit | undefined ;
177176 const fetchImpl = ( async ( _url : string , init ?: RequestInit ) => {
178177 capturedBody = init ?. body as string ;
179- capturedHeaders = init ?. headers ;
180178 return new Response (
181179 JSON . stringify ( {
182180 access_token : "new_at" ,
@@ -194,7 +192,6 @@ describe("auth/oauth", () => {
194192 expect ( tokens . refresh_token ) . toBe ( "new_rt" ) ;
195193 expect ( capturedBody ) . toContain ( "grant_type=refresh_token" ) ;
196194 expect ( capturedBody ) . toContain ( "refresh_token=old_rt" ) ;
197- expect ( capturedHeaders ) . toMatchObject ( { heygen_route : "canary" } ) ;
198195
199196 // Should have persisted.
200197 const { credentials } = await readStore ( ) ;
@@ -298,18 +295,15 @@ describe("auth/oauth", () => {
298295
299296 it ( "sends token_type_hint when provided" , async ( ) => {
300297 let capturedBody = "" ;
301- let capturedHeaders : HeadersInit | undefined ;
302298 const fetchImpl = ( async ( _url : string , init ?: RequestInit ) => {
303299 capturedBody = init ?. body as string ;
304- capturedHeaders = init ?. headers ;
305300 return new Response ( "" , { status : 200 } ) ;
306301 } ) as unknown as typeof fetch ;
307302 await revokeTokens ( "tok" , {
308303 fetchImpl,
309304 token_type_hint : "refresh_token" ,
310305 } ) ;
311306 expect ( capturedBody ) . toContain ( "token_type_hint=refresh_token" ) ;
312- expect ( capturedHeaders ) . toMatchObject ( { heygen_route : "canary" } ) ;
313307 } ) ;
314308
315309 it ( "returns silently when client_id is unconfigured (no throw)" , async ( ) => {
@@ -343,21 +337,6 @@ describe("auth/oauth", () => {
343337 } ) ;
344338
345339 describe ( "startAuthorizationCodeFlow persistence" , ( ) => {
346- it ( "routes the authorization-code exchange through canary" , async ( ) => {
347- let capturedHeaders : HeadersInit | undefined ;
348- const fetchImpl = ( async ( _url : string | URL | Request , init ?: RequestInit ) => {
349- capturedHeaders = init ?. headers ;
350- return new Response ( JSON . stringify ( { access_token : "new_at" } ) , {
351- status : 200 ,
352- headers : { "content-type" : "application/json" } ,
353- } ) ;
354- } ) as typeof fetch ;
355-
356- await startAuthorizationCodeFlow ( { fetchImpl } ) ;
357-
358- expect ( capturedHeaders ) . toMatchObject ( { heygen_route : "canary" } ) ;
359- } ) ;
360-
361340 it ( "overwrites the OAuth block on fresh login (no inherited refresh_token)" , async ( ) => {
362341 // Pre-seed a prior session whose refresh_token must NOT leak into
363342 // the new login when the new response omits one.
@@ -471,11 +450,7 @@ describe("auth/oauth", () => {
471450 } ) ;
472451
473452 it ( "polls pending and slow_down responses without persisting before identity verification" , async ( ) => {
474- const requests : Array < {
475- url : string ;
476- body : URLSearchParams ;
477- headers : HeadersInit | undefined ;
478- } > = [ ] ;
453+ const requests : Array < { url : string ; body : URLSearchParams } > = [ ] ;
479454 const responses = [
480455 new Response (
481456 JSON . stringify ( {
@@ -510,7 +485,6 @@ describe("auth/oauth", () => {
510485 requests . push ( {
511486 url : String ( url ) ,
512487 body : new URLSearchParams ( String ( init ?. body ?? "" ) ) ,
513- headers : init ?. headers ,
514488 } ) ;
515489 } ) ;
516490 const sleeps : number [ ] = [ ] ;
@@ -540,12 +514,6 @@ describe("auth/oauth", () => {
540514 expect ( requests [ 1 ] ?. body . get ( "grant_type" ) ) . toBe (
541515 "urn:ietf:params:oauth:grant-type:device_code" ,
542516 ) ;
543- expect ( requests . map ( ( { headers } ) => headers ) ) . toEqual ( [
544- expect . objectContaining ( { heygen_route : "canary" } ) ,
545- expect . objectContaining ( { heygen_route : "canary" } ) ,
546- expect . objectContaining ( { heygen_route : "canary" } ) ,
547- expect . objectContaining ( { heygen_route : "canary" } ) ,
548- ] ) ;
549517 expect ( ( await readStore ( ) ) . source ) . toBe ( "absent" ) ;
550518
551519 await persistFreshOAuth ( tokens ) ;
0 commit comments