Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #272 from proksoup/master

Boundary begins with CRLF?
  • Loading branch information...
commit daaad88bef35fddc1296c0b05e00de15245cbee9 2 parents 5eb4c0a + 0a8a5ab
@mikeal mikeal authored
Showing with 21 additions and 0 deletions.
  1. +4 −0 main.js
  2. +17 −0 tests/test-body.js
View
4 main.js
@@ -661,6 +661,10 @@ Request.prototype.multipart = function (multipart) {
if (!multipart.forEach) throw new Error('Argument error, options.multipart.')
+ if (self.preambleCRLF) {
+ self.body.push(new Buffer('\r\n'))
+ }
+
multipart.forEach(function (part) {
var body = part.body
if(body == null) throw Error('Body attribute missing in multipart.')
View
17 tests/test-body.js
@@ -66,6 +66,23 @@ var tests =
, {'body': 'Oh hi.'}
]
}
+ , testPutMultipartPreambleCRLF :
+ { resp: server.createPostValidator(
+ '\r\n--__BOUNDARY__\r\n' +
+ 'content-type: text/html\r\n' +
+ '\r\n' +
+ '<html><body>Oh hi.</body></html>' +
+ '\r\n--__BOUNDARY__\r\n\r\n' +
+ 'Oh hi.' +
+ '\r\n--__BOUNDARY__--'
+ )
+ , method: "PUT"
+ , preambleCRLF: true
+ , multipart:
+ [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
+ , {'body': 'Oh hi.'}
+ ]
+ }
}
s.listen(s.port, function () {
Please sign in to comment.
Something went wrong with that request. Please try again.