diff --git a/lib/server-response.js b/lib/server-response.js index 538b40e..853a6e2 100644 --- a/lib/server-response.js +++ b/lib/server-response.js @@ -42,10 +42,11 @@ class ServerResponse { * @return {object} response - object suitable for sending via HTTP */ createResponseObject(httpCode, resultPayload) { + let status = ServerResponse.STATUS[httpCode] || [`${httpCode}`, `Unknown statusCode ${httpCode}`]; let response = Object.assign({ statusCode: httpCode, - statusMessage: ServerResponse.STATUS[httpCode][ServerResponse.STATUSMESSAGE], - statusDescription: ServerResponse.STATUS[httpCode][ServerResponse.STATUSDESCRIPTION], + statusMessage: status[ServerResponse.STATUSMESSAGE], + statusDescription: status[ServerResponse.STATUSDESCRIPTION], result: {} }, resultPayload || {}); return response;