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

How to tell if a request doesn't have a body? #139

Closed
mike-zorn opened this issue Nov 5, 2015 · 1 comment
Closed

How to tell if a request doesn't have a body? #139

mike-zorn opened this issue Nov 5, 2015 · 1 comment
Assignees
Labels

Comments

@mike-zorn
Copy link

I use the json parser as middleware in an express app, but for all requests (even with Content-Type: text/plain), the parser will set req.body to an empty object, so I can't use that to see if the request has a body. The json parser sets req.body before deciding to parse it. What's the best way to determine whether or not a request has a body when using this middleware?

@dougwilson dougwilson self-assigned this Nov 5, 2015
@dougwilson
Copy link
Contributor

#128 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants