Skip to content

Commit

Permalink
Adding clobber argument for appending to headers. thanks @isaacs
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeal committed Feb 18, 2012
1 parent a482e48 commit 3c6581a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,10 @@ Request.prototype.pipeDest = function (dest) {
}

// Composable API
Request.prototype.setHeader = function (name, value) {
if (!this.headers) this.headers = {}
this.headers[name] = value
Request.prototype.setHeader = function (name, value, clobber) {
if (clobber === undefined) clobber = true
if (clobber) this.headers[name] = value
else this.headers[name] += ',' + value
return this
}
Request.prototype.setHeaders = function (headers) {
Expand Down

0 comments on commit 3c6581a

Please sign in to comment.