File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ export {
1616 JwtExpiredError ,
1717} from "aws-jwt-verify/error" ;
1818
19+ const DEFAULT_MAX_CACHED_SESSIONS : number = 50 ;
20+
1921export interface CookieSettings {
2022 idToken : string ;
2123 accessToken : string ;
@@ -24,6 +26,10 @@ export interface CookieSettings {
2426 [ key : string ] : string ;
2527}
2628
29+ function getDefaultAgent ( ) : Agent {
30+ return new Agent ( { rejectUnauthorized : true , maxCachedSessions : DEFAULT_MAX_CACHED_SESSIONS } ) ;
31+ }
32+
2733function getDefaultCookieSettings ( props : {
2834 mode : "spaMode" | "staticSiteMode" ;
2935 compatibility : "amplify" | "elasticsearch" ;
@@ -503,7 +509,7 @@ export async function httpPostToCognitoWithRetry(
503509 ++ attempts ;
504510 try {
505511 return await fetch ( url , data , {
506- agent : AGENT ,
512+ agent : AGENT || getDefaultAgent ( ) ,
507513 ...options ,
508514 method : "POST" ,
509515 } ) . then ( ( res ) => {
You can’t perform that action at this time.
0 commit comments