Skip to content
Snippets Groups Projects
Commit e5f03576 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento Committed by Gabriel Engel
Browse files

Fix problem with middleware that tries to parse json body

parent 663dc7b8
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,9 @@ WebApp.rawConnectHandlers.use (req, res, next) -> ...@@ -8,6 +8,9 @@ WebApp.rawConnectHandlers.use (req, res, next) ->
if req.headers['transfer-encoding'] is undefined and isNaN(req.headers['content-length']) if req.headers['transfer-encoding'] is undefined and isNaN(req.headers['content-length'])
return next() return next()
if req.headers['content-type'] not in ['', undefined]
return next()
buf = '' buf = ''
req.setEncoding('utf8') req.setEncoding('utf8')
req.on 'data', (chunk) -> buf += chunk req.on 'data', (chunk) -> buf += chunk
...@@ -20,6 +23,7 @@ WebApp.rawConnectHandlers.use (req, res, next) -> ...@@ -20,6 +23,7 @@ WebApp.rawConnectHandlers.use (req, res, next) ->
catch err catch err
req.body = buf req.body = buf
req._body = true
next() next()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment