Do not try doing stuff with body if undefined (ex: 500 status code).

This commit is contained in:
OniOni
2013-04-19 12:15:11 -07:00
parent 4967a9614c
commit 31ddfb36a2

View File

@@ -41,9 +41,11 @@ module.exports = function(appium) {
request(url, req.route.method.toUpperCase(), req.body,
req.headers['content-type'], function(err, response, body) {
if (err) return next(err);
var sbody = body ? JSON.stringify(body).slice(0, 1000) : body;
logger.debug("Proxied response received with status " +
response.statusCode + ": " +
JSON.stringify(body).slice(0, 1000));
sbody);
res.headers = response.headers;
res.send(response.statusCode, body);
});