Bug Fixed at Platform Client crashing when Http Request Body could not be read.

This commit is contained in:
Luis Fernando Molina committed 2021-09-19 10:20:16 +02:00
1 parent 8757d26487
commit 79f0438079
2 files changed
+21 -14

No files matched your search

@@ -6,7 +6,7 @@ exports.newFoundationsUtilitiesHttpRequests = function () {
return thisObject
function getRequestBody(httpRequest, callback) { // Gets the de body from a POST httpRequest to the web server
function getRequestBody(httpRequest, httpResponse, callback) { // Gets the de body from a POST httpRequest to the web server
try {
let body = ''
@@ -26,10 +26,12 @@ exports.newFoundationsUtilitiesHttpRequests = function () {
httpRequest.on('error', function (err) {
console.log('[ERROR] getBody -> err.stack = ' + err.stack)
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
throw('Not possible to get HTTP Body.')
})
} catch (err) {
console.log('[ERROR] getBody -> err.stack = ' + err.stack)
SA.projects.foundations.utilities.httpResponses.respondWithContent(JSON.stringify(global.DEFAULT_FAIL_RESPONSE), httpResponse)
throw('Not possible to get HTTP Body.')
}
}
}