File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,16 @@ async function makeRequest(contacts) {
1616
1717 return new Promise ( ( resolve , reject ) => {
1818
19+ const stringBuffer = new Buffer . from ( `${ process . env . AUTH_USERNAME } :${ process . env . AUTH_PASSWORD } ` , "utf-8" )
20+ const basicAuthToken = stringBuffer . toString ( 'base64' )
21+
1922 fetch ( `http://localhost:${ port } /sessions` , {
2023 method : 'post' ,
2124 body : JSON . stringify ( body ) ,
22- headers : { 'Content-Type' : 'application/json' }
25+ headers : {
26+ 'Content-Type' : 'application/json' ,
27+ 'Authorization' : `Basic ${ basicAuthToken } `
28+ }
2329 } )
2430 . then ( res => {
2531 const data = res . json ( )
@@ -39,13 +45,13 @@ async function runTest() {
3945 let results = [ ] ;
4046 try {
4147 const requests = [ ] ;
42- for ( let i = 0 ; i < 300 ; ++ i ) {
48+ for ( let i = 0 ; i < 1000 ; ++ i ) {
4349 const contacts = [ '+1925215' + ( '0000' + i ) . slice ( - 4 ) , '+1925635' + ( '0000' + i ) . slice ( - 4 ) ] ;
4450 console . log ( contacts )
4551
4652 const promise = makeRequest ( contacts )
4753 requests . push ( promise ) ;
48- await sleep ( 2 )
54+ await sleep ( 100 )
4955 }
5056
5157 results = await Promise . allSettled ( requests ) ;
You can’t perform that action at this time.
0 commit comments