Skip to content

Commit

Permalink
fix: response when meta not included
Browse files Browse the repository at this point in the history
  • Loading branch information
willfarrell committed May 15, 2018
1 parent 694d332 commit 94a8fbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ typings/
# dotenv environment variables file
.env

# IDE
.idea
*.iml
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,13 @@ const response = (opts, handler, next) => {
)

// add in meta
if (response.meta || handler.response.body.meta) {
if (response.meta) {
handler.response.body.meta = Object.assign(
{},
response.meta,
handler.response.body.meta || {}
(handler.response.body && handler.response.body.meta) || {}
)
} // Ensure meta is preserved, assign isn't deep
}
handler.response.body = Object.assign({}, response, handler.response.body)
// catch any errors
if (handler.error) {
Expand Down

0 comments on commit 94a8fbf

Please sign in to comment.