Skip to content
Myr

Merge branch 'fix-querystring-0'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parents 7441164, b994509 · Browse files · 2 files+12 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−7 removed

  • tests:+3 added−1 removed
  • other:+9 added−6 removed

2 files+12 added−7 removed

modified:lib/express/request.js+9 added-6 removed
76 unmodified lines
77 : this.response.headers[key.lowercase] = val78 },79 80 /**81 * Return a param _key_ value or null.81 * Return the param _key_ value or undefined.82 *83 * - Checks route populated path parameters84 * - Checks POST parameters83 * - Checks GET parameters84 * - Checks POST parameters85 * - Checks route populated path parameters86 *87 * @param {string} key88 * @return {string}89 * @api public90 */9192 param: function(key) {93 return this.params.get[key] ||94 this.params.post[key] ||95 this.params.path[key]93 if (key in this.params.get)94 return this.params.get[key]95 if (key in this.params.post)96 return this.params.post[key]97 if (key in this.params.path)98 return this.params.path[key]99 },100 101 /**102 * Check if Accept header includes the mime type
247 unmodified lines
modified:spec/spec.request.js+3 added-1 removed
200 unmodified lines
201 end202203 it 'should work with a query string'204 get('/user', function(){205 return String(this.param('page') || 'First page')205 var page = this.param('page')206 return page === undefined ? 'First page' : String(page)207 })208 get('/user').body.should.eql 'First page'209 get('/user?page=0').body.should.eql '0'210 get('/user?page=2').body.should.eql '2'211 get('/user?foo[]=bar&page=5').body.should.eql '5'212 end213
156 unmodified lines