Skip to content

Commit

Permalink
fix: ensure body is set early
Browse files Browse the repository at this point in the history
  • Loading branch information
willfarrell committed May 15, 2018
1 parent 4326e0a commit ef3f992
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,17 @@ const response = (opts, handler, next) => {
handler.response.headers
)

handler.response.body = Object.assign({}, response, handler.response.body)

// add in meta
if (response.meta) {
handler.response.body.meta = Object.assign(
{},
response.meta,
(handler.response.body && handler.response.body.meta) || {}
handler.response.body.meta || {}
)
}
handler.response.body = Object.assign({}, response, handler.response.body)

// catch any errors
if (handler.error) {
if (typeof options.logger === 'function') {
Expand Down

0 comments on commit ef3f992

Please sign in to comment.