mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Ensure all data is read, not just first chunk
This commit is contained in:
@@ -22,7 +22,13 @@ console.log(`...Testing connection to REST API at ${restUrl}...\n`);
|
||||
if (appConfig.rest.ssl) {
|
||||
const req = https.request(restUrl, (res) => {
|
||||
console.log(`RESPONSE: ${res.statusCode} ${res.statusMessage} \n`);
|
||||
res.on('data', (data) => {
|
||||
// We will keep reading data until the 'end' event fires.
|
||||
// This ensures we don't just read the first chunk.
|
||||
let data = '';
|
||||
res.on('data', (chunk) => {
|
||||
data += chunk;
|
||||
});
|
||||
res.on('end', () => {
|
||||
checkJSONResponse(data);
|
||||
});
|
||||
});
|
||||
@@ -35,7 +41,13 @@ if (appConfig.rest.ssl) {
|
||||
} else {
|
||||
const req = http.request(restUrl, (res) => {
|
||||
console.log(`RESPONSE: ${res.statusCode} ${res.statusMessage} \n`);
|
||||
res.on('data', (data) => {
|
||||
// We will keep reading data until the 'end' event fires.
|
||||
// This ensures we don't just read the first chunk.
|
||||
let data = '';
|
||||
res.on('data', (chunk) => {
|
||||
data += chunk;
|
||||
});
|
||||
res.on('end', () => {
|
||||
checkJSONResponse(data);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user