Skip to content

Commit

Permalink
Multipart requests should respect content-type if set; Issue request#145
Browse files Browse the repository at this point in the history
  • Loading branch information
apeace committed Jan 3, 2012
1 parent 9eb5a18 commit 1a91675
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 1a91675

Please sign in to comment.