From 6b2b9d5db238e32991877ca7dd6954f28fbd0f84 Mon Sep 17 00:00:00 2001 From: Abigail Watson Date: Fri, 6 Jan 2017 18:51:12 -0600 Subject: [PATCH] adjusted order of calls in JsonRoutes.sendResult() --- packages/json-routes/json-routes.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/json-routes/json-routes.js b/packages/json-routes/json-routes.js index 5cbe6a9..6ce41ac 100644 --- a/packages/json-routes/json-routes.js +++ b/packages/json-routes/json-routes.js @@ -105,16 +105,16 @@ JsonRoutes.setResponseHeaders = function (headers) { JsonRoutes.sendResult = function (res, options) { options = options || {}; - // We've already set global headers on response, but if they - // pass in more here, we set those. - if (options.headers) setHeaders(res, options.headers); - // Set status code on response res.statusCode = options.code || 200; // Set response body writeJsonToBody(res, options.data); + // We've already set global headers on response, but if they + // pass in more here, we set those. + if (options.headers) setHeaders(res, options.headers); + // Send the response res.end(); };