Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Okay, trying it as an optional parameter, with a new test in test-bod…

…y.js to verify
  • Loading branch information...
commit 54226a38816b4169e0a7a5d8b1a7feba78235fec 1 parent 396531d
Derek Bredensteiner authored
View
5 main.js
@@ -661,7 +661,10 @@ Request.prototype.multipart = function (multipart) {
if (!multipart.forEach) throw new Error('Argument error, options.multipart.')
- self.body.push(new Buffer('\r\n'))
+ 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
@@ -52,6 +52,22 @@ var tests =
}
, testPutMultipart :
{ resp: server.createPostValidator(
+ '--__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"
+ , multipart:
+ [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
+ , {'body': 'Oh hi.'}
+ ]
+ }
+ , testPutMultipartPreambleCRLF :
+ { resp: server.createPostValidator(
'\r\n--__BOUNDARY__\r\n' +
'content-type: text/html\r\n' +
'\r\n' +
@@ -61,6 +77,7 @@ var tests =
'\r\n--__BOUNDARY__--'
)
, method: "PUT"
+ , preambleCRLF: true
, multipart:
[ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
, {'body': 'Oh hi.'}
View
2  tests/test-https-strict.js
@@ -52,7 +52,7 @@ var tests =
}
, testPutMultipart :
{ resp: server.createPostValidator(
- '\r\n--__BOUNDARY__\r\n' +
+ '--__BOUNDARY__\r\n' +
'content-type: text/html\r\n' +
'\r\n' +
'<html><body>Oh hi.</body></html>' +
View
2  tests/test-https.js
@@ -44,7 +44,7 @@ var tests =
}
, testPutMultipart :
{ resp: server.createPostValidator(
- '\r\n--__BOUNDARY__\r\n' +
+ '--__BOUNDARY__\r\n' +
'content-type: text/html\r\n' +
'\r\n' +
'<html><body>Oh hi.</body></html>' +
Please sign in to comment.
Something went wrong with that request. Please try again.