Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

do not wait for end event on GET and DELETE #7

Closed
wants to merge 1 commit into from

1 participant

@Filirom1
Owner

Hi

This PR fix a bug when the end event is already emitted on a GET request without Content-Type

@Filirom1
Owner

Forget about this PR.

When chaining several asynchronous middleware. Some middleware will never get the end event because it was already emitted.

I solve this issue simply by changing middleware orders.

@Filirom1 Filirom1 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 27, 2013
  1. @Filirom1
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/validator.coffee
View
4 src/validator.coffee
@@ -260,6 +260,10 @@ validate = (req, path, specs, next) ->
)
return process() if req.is('json') or req.is('application/x-www-form-urlencoded') or req.is('multipart/form-data')
+
+ # do not try body parsing if there is no body to parse
+ return process() if req.method in ['GET', 'DELETE']
+
# body parsing, if incoming request is not json, multipart or form-urlencoded
# by default, no body
delete req.body
Something went wrong with that request. Please try again.