Skip to content

Commit

Permalink
Merge pull request request#146 from apeace/master
Browse files Browse the repository at this point in the history
Multipart should respect content-type if previously set
  • Loading branch information
mikeal committed Jan 4, 2012
2 parents 9eb5a18 + 1a91675 commit f9c5460
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.js
Expand Up @@ -264,7 +264,13 @@ Request.prototype.request = function () {

} else if (self.multipart) {
self.body = []
self.headers['content-type'] = 'multipart/related;boundary="frontier"'

if (!self.headers['content-type']) {
self.headers['content-type'] = 'multipart/related;boundary="frontier"';
} else {
self.headers['content-type'] = self.headers['content-type'].split(';')[0] + ';boundary="frontier"';
}

if (!self.multipart.forEach) throw new Error('Argument error, options.multipart.')

self.multipart.forEach(function (part) {
Expand Down

0 comments on commit f9c5460

Please sign in to comment.