Skip to content
Myr

header() now returns request header when no value is passed

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

authored by visionmedia · committed by visionmedia · parent c85b735 · Browse files · 3 files+8 added−4 removed
This commit

State

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

Diff stats

3 files+8 added−4 removed

  • tests:+3 added−0 removed
  • other:+5 added−4 removed

3 files+8 added−4 removed

modified:lib/express.core.js+4 added-3 removed
172 unmodified lines
173 },174 175 /**176 * Sets _name_ header to _value_. When _value_177 * is not present the value of the header _name_178 * will be returned (if available).177 * is not present the request header will be returned.178 *179 * @param {string} name180 * @param {string} value181 * @api public182 */183 184 header : function(name, value) {185 return value ? this.response.headers[name] = value :187 this.response.headers[name]186 this.request.headers[name] || this.response.headers[name]187 },188 189 /**190 * Return param _key_'s value or _defaultValue_ when
344 unmodified lines
535 'list of articles'536})537538get(/articles\/(\d+)/, function(){539 header('Content-Type', 'text/html')540 p(header('Accept'))541 'article id ' + captures[1]542})543544get('articles/:name', function(){
7 unmodified lines
modified:spec/spec.core.js+3 added
modified:README.rdoc+1 added-1 removed
52 unmodified lines
53 'User deleted' :54 'Failed to delete user'55 })56 57== Setting Headers57== Headers5859 get ('foo', function(){60 header('Content-Type', 'text/html')61 '<p>bar</p>'
26 unmodified lines