Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serialize headers (renamed header to headers) #16

Merged
merged 1 commit into from
Oct 12, 2018

Conversation

JamesKyburz
Copy link
Contributor

Currently headers are not sent when logging a http response.

log.child({ res }).debug('response!')

currently returns

{
  "statusCode": 200,
  "header": null
}

This PR makes sure that "headers" are sent instead of "header".

Also added a test 😄

Copy link
Member

@jsumners jsumners left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JamesKyburz
Copy link
Contributor Author

@jsumners Thanks!

I might have missed something here, Readme states that "header" is an Array. However I always got null when executing log.child({ res }).debug('response!') which was the reason for this PR 😄

@jsumners
Copy link
Member

Readme should be updated as well if this PR is a resolution.

@JamesKyburz
Copy link
Contributor Author

@jsumners Agreed.

Just updated PR!

  • I have updated lib/res.js (forgot to rename header to headers in Object.create)
  • Added one more assertion for a header with array values.
  • Updated readme

Readme.md Outdated
@@ -70,7 +70,7 @@ The default `response` serializer. Returns an object:
```js
{
statusCode: Number,
header: Array, // The list of headers to be sent in the response.
header: Object, // The headers to be sent in the response.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be headers:  instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcollina good catch 😀, can update the PR tmrw.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated to PR now.

@JamesKyburz
Copy link
Contributor Author

Just updated Readme in PR!

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mcollina mcollina merged commit e2ea83b into pinojs:master Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants