File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,7 +22,13 @@ console.log(`...Testing connection to REST API at ${restUrl}...\n`);
2222if ( appConfig . rest . ssl ) {
2323 const req = https . request ( restUrl , ( res ) => {
2424 console . log ( `RESPONSE: ${ res . statusCode } ${ res . statusMessage } \n` ) ;
25- res . on ( 'data' , ( data ) => {
25+ // We will keep reading data until the 'end' event fires.
26+ // This ensures we don't just read the first chunk.
27+ let data = '' ;
28+ res . on ( 'data' , ( chunk ) => {
29+ data += chunk ;
30+ } ) ;
31+ res . on ( 'end' , ( ) => {
2632 checkJSONResponse ( data ) ;
2733 } ) ;
2834 } ) ;
@@ -35,7 +41,13 @@ if (appConfig.rest.ssl) {
3541} else {
3642 const req = http . request ( restUrl , ( res ) => {
3743 console . log ( `RESPONSE: ${ res . statusCode } ${ res . statusMessage } \n` ) ;
38- res . on ( 'data' , ( data ) => {
44+ // We will keep reading data until the 'end' event fires.
45+ // This ensures we don't just read the first chunk.
46+ let data = '' ;
47+ res . on ( 'data' , ( chunk ) => {
48+ data += chunk ;
49+ } ) ;
50+ res . on ( 'end' , ( ) => {
3951 checkJSONResponse ( data ) ;
4052 } ) ;
4153 } ) ;
You can’t perform that action at this time.
0 commit comments