Skip to content

Detect header sent status at middleware handler #2395

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

Closed
wants to merge 1 commit into from

Conversation

jeffjen
Copy link

@jeffjen jeffjen commented Jul 26, 2016

These middleware were used in many places throughout the handler pipeline. It is best to check the status of the header sent field on the express response object before running the run on send again.

@codecov-io
Copy link

codecov-io commented Jul 26, 2016

Current coverage is 91.85% (diff: 100%)

Merging #2395 into master will increase coverage by <.01%

@@             master      #2395   diff @@
==========================================
  Files            95         95          
  Lines         10708      10714     +6   
  Methods        1309       1309          
  Messages          0          0          
  Branches       1741       1743     +2   
==========================================
+ Hits           9835       9841     +6   
  Misses          873        873          
  Partials          0          0          

Powered by Codecov. Last update fa49f05...176a6d0

@flovilmart
Copy link
Contributor

I'm afraid that when we added the next it uncovered an issue related to the order of processing of each route handlers. Could you pin-point why those middlewares are not processed in the right order?

@jeffjen
Copy link
Author

jeffjen commented Jul 26, 2016

I only did what I could to address the symptom.

The symptom was allowCrossOrigin fired after the header was sent.

This occurred when I was testing my own email verify/password reset. Whenever the page was served the middleware attempts to send CORS headers, which triggered the first "header already sent" error, gets captured by hadnlerParseError middleware, and triggered another "header already sent" error.

@flovilmart
Copy link
Contributor

Uhm, that's odd. My worry is is that we don't solve the issue by removing the root cause, but just by letting the middleware skip.

@flovilmart
Copy link
Contributor

This will be fixed by #2475

@flovilmart flovilmart closed this Aug 6, 2016
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