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

Report statusCode and uri accurately for POSTs #57 #58

Merged
merged 4 commits into from
Feb 2, 2019

Conversation

avolfson
Copy link
Contributor

With a listener on the req.on('end') event, req.route and res.statusCode are undefined. Switching to res.on('finish') makes these values available.

#57

@fieldju
Copy link
Member

fieldju commented Jan 30, 2019

image

The build appears to be failing with this PR.

Which is weird because res.on was already there.

Are you sure this isn't supposed to be req.on('finish')

Fixes issue yaorg#57 by listening on the `res.on('finish')` instead of req.on('end')` event. 
Due to some quirk with express bodyParsers, `req.route` and `res.statusCode` were undefined in the req.on('end') event.
@avolfson
Copy link
Contributor Author

avolfson commented Feb 2, 2019

Added a reproducing integration test and updated the unit test, so now the fix's PR is in good shape.

@avolfson
Copy link
Contributor Author

avolfson commented Feb 2, 2019

Is there anyway to update the example at https://yaorg.github.io/node-measured/packages/measured-signalfx-reporter/tutorial-SignalFx%20Express%20Full%20End%20to%20End%20Example.html to mention that this middleware must precede bodyParser middleware? This was another bug that was hard to discover for me 😆

@fieldju
Copy link
Member

fieldju commented Feb 2, 2019 via email

Copy link
Member

@fieldju fieldju left a comment

Choose a reason for hiding this comment

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

LGTM

@fieldju fieldju merged commit ad0ea67 into yaorg:master Feb 2, 2019
@coveralls
Copy link

Pull Request Test Coverage Report for Build 353

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.512%

Totals Coverage Status
Change from base Build 347: 0.0%
Covered Lines: 749
Relevant Lines: 827

💛 - Coveralls

@avolfson avolfson deleted the avolfson-patch-issue-57 branch February 2, 2019 16:55
@avolfson avolfson changed the title Report statusCode and uri accurately for POSTs Report statusCode and uri accurately for POSTs #57 Feb 2, 2019
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