Requesting http://localhost// (two slashes) causes crash
Closed this issue · 2 comments
overra commented
I was running this example:
var gh = require('grasshopper'); gh.get('/', function() { this.model['name'] = 'Adam'; this.render('home'); }); gh.serve(80);
Everything works as expected, but if you request http://localhost// instead of http://localhost/ it crashes with this error:
/usr/local/lib/node/.npm/grasshopper/0.2.2/package/lib/renderer.js:100 if(path.match(/\.[^\/]+$/)) { ^ TypeError: Cannot call method 'match' of undefined at RequestContext.getExtn (/usr/local/lib/node/.npm/grasshopper/0.2.2/package/lib/renderer.js:100:13) at new RequestContext (/usr/local/lib/node/.npm/grasshopper/0.2.2/package/lib/renderer.js:69:22) at Object.handleError (/usr/local/lib/node/.npm/grasshopper/0.2.2/package/lib/renderer.js:41:5) at Server. (/usr/local/lib/node/.npm/grasshopper/0.2.2/package/lib/grasshopper.js:82:22) at Server.emit (events:33:26) at HTTPParser.onIncoming (http:829:10) at HTTPParser.onHeadersComplete (http:87:31) at Stream.ondata (http:761:22) at IOWatcher.callback (net:517:29) at node.js:267:9