Bug Fixed at Platform Client crashing when Http Request Body could not be read.
This commit is contained in:
1 parent
8757d26487
commit
79f0438079
2 files changed
+21
-14
No files matched your search
@@ -43,7 +43,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
|
||||
case 'WEB3':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
@@ -131,7 +131,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
break
|
||||
case 'CCXT':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
@@ -242,7 +242,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
break
|
||||
}
|
||||
case 'New-Message': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
function processRequest(messageReceived) {
|
||||
let timestamp = (new Date()).valueOf()
|
||||
@@ -291,7 +291,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
{
|
||||
switch (requestPath[2]) { // switch by command
|
||||
case 'Save-Node-Schema': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
@@ -322,7 +322,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
case 'Save-Concept-Schema': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
@@ -353,7 +353,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
case 'Save-Topic-Schema': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
@@ -384,7 +384,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
case 'Save-Tutorial-Schema': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
@@ -415,7 +415,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
case 'Save-Review-Schema': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
@@ -446,7 +446,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
|
||||
case 'Save-Book-Schema': {
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
@@ -991,7 +991,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
related to the Governance System are implemented here and routed
|
||||
to the backend Servers that can process them.
|
||||
*/
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
@@ -1412,7 +1412,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
break
|
||||
case 'SavePlugin':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
try {
|
||||
@@ -1546,7 +1546,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
break
|
||||
case 'SaveWorkspace':
|
||||
{
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, processRequest)
|
||||
SA.projects.foundations.utilities.httpRequests.getRequestBody(httpRequest, httpResponse, processRequest)
|
||||
|
||||
async function processRequest(body) {
|
||||
|
||||
@@ -1702,7 +1702,12 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err.stack)
|
||||
if (err.stack !== undefined) {
|
||||
console.log(err.stack)
|
||||
}
|
||||
if (err.message !== undefined) {
|
||||
console.log('[ERROR] onHttpRequest -> err.message = ' + err.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.')
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user