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
fix(recorder): allow recording req headers when not outputting objects #1617
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There was no test that `output_objects: true`, without also setting `dont_print: true` so this flow was not covered.
When exploring coverage gaps a few things were uncovered: - OutgoingMessage._headers has been deprecated in favor of `getHeaders()`. https://nodejs.org/api/deprecations.html#deprecations_dep0066_outgoingmessage_prototype_headers_outgoingmessage_prototype_headernames - IncommingMessage.rawHeaders is never falsy so there isn't a need to fall back to `headers` - There was a bug that kept request headers from being added to `matchHeader` lines in non-object outputs. `enable_reqheaders_recording` was only having an affect if `output_objects` was also true, but headers were never being added despite that because it was looking for headers under the wrong attribute on the request. A test was added to cover the flow of wanting the `matchHeader` as the other flow was already covered.
gr2m
approved these changes
Jul 12, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. Nice catch, too 👍
🎉 This PR is included in version 11.0.0-beta.24 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 11.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
gr2m
pushed a commit
that referenced
this pull request
Sep 4, 2019
#1617) * test: add coverage for logging recorded objects There was no test that `output_objects: true`, without also setting `dont_print: true` so this flow was not covered. * fix: allow recording req headers when not outputting objects When exploring coverage gaps a few things were uncovered: - OutgoingMessage._headers has been deprecated in favor of `getHeaders()`. https://nodejs.org/api/deprecations.html#deprecations_dep0066_outgoingmessage_prototype_headers_outgoingmessage_prototype_headernames - IncommingMessage.rawHeaders is never falsy so there isn't a need to fall back to `headers` - There was a bug that kept request headers from being added to `matchHeader` lines in non-object outputs. `enable_reqheaders_recording` was only having an affect if `output_objects` was also true, but headers were never being added despite that because it was looking for headers under the wrong attribute on the request. A test was added to cover the flow of wanting the `matchHeader` as the other flow was already covered.
gr2m
pushed a commit
that referenced
this pull request
Sep 4, 2019
#1617) * test: add coverage for logging recorded objects There was no test that `output_objects: true`, without also setting `dont_print: true` so this flow was not covered. * fix: allow recording req headers when not outputting objects When exploring coverage gaps a few things were uncovered: - OutgoingMessage._headers has been deprecated in favor of `getHeaders()`. https://nodejs.org/api/deprecations.html#deprecations_dep0066_outgoingmessage_prototype_headers_outgoingmessage_prototype_headernames - IncommingMessage.rawHeaders is never falsy so there isn't a need to fall back to `headers` - There was a bug that kept request headers from being added to `matchHeader` lines in non-object outputs. `enable_reqheaders_recording` was only having an affect if `output_objects` was also true, but headers were never being added despite that because it was looking for headers under the wrong attribute on the request. A test was added to cover the flow of wanting the `matchHeader` as the other flow was already covered.
gr2m
pushed a commit
that referenced
this pull request
Sep 5, 2019
#1617) * test: add coverage for logging recorded objects There was no test that `output_objects: true`, without also setting `dont_print: true` so this flow was not covered. * fix: allow recording req headers when not outputting objects When exploring coverage gaps a few things were uncovered: - OutgoingMessage._headers has been deprecated in favor of `getHeaders()`. https://nodejs.org/api/deprecations.html#deprecations_dep0066_outgoingmessage_prototype_headers_outgoingmessage_prototype_headernames - IncommingMessage.rawHeaders is never falsy so there isn't a need to fall back to `headers` - There was a bug that kept request headers from being added to `matchHeader` lines in non-object outputs. `enable_reqheaders_recording` was only having an affect if `output_objects` was also true, but headers were never being added despite that because it was looking for headers under the wrong attribute on the request. A test was added to cover the flow of wanting the `matchHeader` as the other flow was already covered.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1607 (assuming #1616 is merged in first)
Part of #1404
While this work started out as just an effort to add coverage to recorder.js, I found/fixed a bug so I'm using the
fix
type.There was a bug that kept request headers from being added to
matchHeader
lines in non-object outputs.enable_reqheaders_recording
was only having an affect ifoutput_objects
was also true, but headers were never being added despite that because it was looking for headers under the wrong attribute on the request.A test was added to cover the flow of wanting the
matchHeader
as the other flow was already covered.There are a couple other changes intertwined with the bug fix. It seemed cleaner to PR them together since it's all so tightly coupled. Things to keep in mind:
OutgoingMessage._headers
has been deprecated in favor ofgetHeaders()
IncommingMessage.rawHeaders
is never falsy so there isn't a need to fall back toheaders