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 {
16
16
JwtExpiredError ,
17
17
} from "aws-jwt-verify/error" ;
18
18
19
+ const DEFAULT_MAX_CACHED_SESSIONS : number = 50 ;
20
+
19
21
export interface CookieSettings {
20
22
idToken : string ;
21
23
accessToken : string ;
@@ -24,6 +26,10 @@ export interface CookieSettings {
24
26
[ key : string ] : string ;
25
27
}
26
28
29
+ function getDefaultAgent ( ) : Agent {
30
+ return new Agent ( { rejectUnauthorized : true , maxCachedSessions : DEFAULT_MAX_CACHED_SESSIONS } ) ;
31
+ }
32
+
27
33
function getDefaultCookieSettings ( props : {
28
34
mode : "spaMode" | "staticSiteMode" ;
29
35
compatibility : "amplify" | "elasticsearch" ;
@@ -503,7 +509,7 @@ export async function httpPostToCognitoWithRetry(
503
509
++ attempts ;
504
510
try {
505
511
return await fetch ( url , data , {
506
- agent : AGENT ,
512
+ agent : AGENT || getDefaultAgent ( ) ,
507
513
...options ,
508
514
method : "POST" ,
509
515
} ) . then ( ( res ) => {
You can’t perform that action at this time.
0 commit comments