You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm using express.
And when I am trying to get some url like ?a[b]=1&a[b][c][d]=2, it sends 500 with error stack:
TypeError: Object #<ServerResponse> has no method 'status'
at Object.handle (app/routes/index.js:11:7)
at next (app/node_modules/express/node_modules/connect/lib/proto.js:188:17)
at next (app/node_modules/express/node_modules/connect/lib/proto.js:190:11)
at next (app/node_modules/express/node_modules/connect/lib/proto.js:190:11)
at next (app/node_modules/express/node_modules/connect/lib/proto.js:190:11)
at next (app/node_modules/express/node_modules/connect/lib/proto.js:190:11)
at next (app/node_modules/express/node_modules/connect/lib/proto.js:190:11)
at next (app/node_modules/express/node_modules/connect/lib/proto.js:190:11)
at next (app/node_modules/express/node_modules/connect/lib/proto.js:198:7)
at Function.app.handle (app/node_modules/express/node_modules/connect/lib/proto.js:201:3)
at Server.app (app/express/node_modules/connect/lib/connect.js:65:37)
at Server.EventEmitter.emit (events.js:98:17)
at HTTPParser.parser.onIncoming (http.js:2108:12)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)
at Socket.socket.ondata (http.js:1966:22)
at TCP.onread (net.js:525:27)
I tried to get more information about this problem. And I found out that it is problem with qs.
functionparseString(str){varret=reduce(String(str).split('&'),function(ret,pair){// ... some other codereturnmerge(ret,decode(key),decode(val));},{base: {}}).base;returncompact(ret);}
When I try to execute:
require('qs').parse('a[b]=1&a[b][c][d]=2');
it throws exception:
test/node_modules/qs/index.js:76
if (parent[key].length == 0) return parent[key] = {}
^
TypeError: Cannot read property 'length' of undefined
at promote (test/node_modules/qs/index.js:76:18)
at parse (test/node_modules/qs/index.js:118:52)
at parse (test/node_modules/qs/index.js:119:7)
at parse (test/node_modules/qs/index.js:119:7)
at parse (test/node_modules/qs/index.js:123:7)
at merge (test/node_modules/qs/index.js:137:5)
at reduce.base (test/node_modules/qs/index.js:207:13)
at Array.reduce (native)
at reduce (test/node_modules/qs/index.js:63:52)
at parseString (test/node_modules/qs/index.js:196:13)
But if I change code to qs like this:
functionparseString(str){varret=reduce(String(str).split('&'),function(ret,pair){// ... some other codeconsole.log(merge(ret,decode(key),decode(val)));returnmerge(ret,decode(key),decode(val));},{base: {}}).base;returncompact(ret);}
It works without exceptions and returns some parsed object.
Express does not catch this exception and does not initialize the response object correctly in my case, does it? May be it's a second problem.
The text was updated successfully, but these errors were encountered:
Hello,
I'm using
express
.And when I am trying to get some url like
?a[b]=1&a[b][c][d]=2
, it sends 500 with error stack:I tried to get more information about this problem. And I found out that it is problem with
qs
.And it is a very strange problem. Look at the code https://github.com/visionmedia/node-querystring/blob/master/index.js#L207
When I try to execute:
it throws exception:
But if I change code to
qs
like this:It works without exceptions and returns some parsed object.
Express
does not catch this exception and does not initialize the response object correctly in my case, does it? May be it's a second problem.The text was updated successfully, but these errors were encountered: