Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix tests with boundary by injecting boundry from header

  • Loading branch information...
commit 1f34700e5614ea2a2d78b80dd467c002c3e91cb3 1 parent f8ae8d1
@benatkin benatkin authored
View
14 tests/server.js
@@ -51,11 +51,15 @@ exports.createPostValidator = function (text) {
var r = '';
req.on('data', function (chunk) {r += chunk})
req.on('end', function () {
- if (r !== text) console.log(r, text);
- assert.equal(r, text)
- resp.writeHead(200, {'content-type':'text/plain'})
- resp.write('OK')
- resp.end()
+ if (req.headers['content-type'] && req.headers['content-type'].indexOf('boundary=') >= 0) {
+ var boundary = req.headers['content-type'].split('boundary=')[1];
+ text = text.replace(/__BOUNDARY__/g, boundary);
+ }
+ if (r !== text) console.log(r, text);
+ assert.equal(r, text)
+ resp.writeHead(200, {'content-type':'text/plain'})
+ resp.write('OK')
+ resp.end()
})
}
return l;
View
33 tests/test-body.js
@@ -50,23 +50,22 @@ var tests =
, method: "PUT"
, json: {foo: 'bar'}
}
- // , testPutMultipart :
- // { resp: server.createPostValidator(
- // '--frontier\r\n' +
- // '--15F6786B-D0A8-4AB8-B0A5-DDF721BC6192\\r\\n'
- // 'content-type: text/html\r\n' +
- // '\r\n' +
- // '<html><body>Oh hi.</body></html>' +
- // '\r\n--frontier\r\n\r\n' +
- // 'Oh hi.' +
- // '\r\n--frontier--'
- // )
- // , method: "PUT"
- // , multipart:
- // [ {'content-type': 'text/html', 'body': '<html><body>Oh hi.</body></html>'}
- // , {'body': 'Oh hi.'}
- // ]
- // }
+ , 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.'}
+ ]
+ }
}
s.listen(s.port, function () {
View
6 tests/test-https-strict.js
@@ -52,13 +52,13 @@ var tests =
}
, testPutMultipart :
{ resp: server.createPostValidator(
- '--frontier\r\n' +
+ '--__BOUNDARY__\r\n' +
'content-type: text/html\r\n' +
'\r\n' +
'<html><body>Oh hi.</body></html>' +
- '\r\n--frontier\r\n\r\n' +
+ '\r\n--__BOUNDARY__\r\n\r\n' +
'Oh hi.' +
- '\r\n--frontier--'
+ '\r\n--__BOUNDARY__--'
)
, method: "PUT"
, multipart:
View
6 tests/test-https.js
@@ -44,13 +44,13 @@ var tests =
}
, testPutMultipart :
{ resp: server.createPostValidator(
- '--frontier\r\n' +
+ '--__BOUNDARY__\r\n' +
'content-type: text/html\r\n' +
'\r\n' +
'<html><body>Oh hi.</body></html>' +
- '\r\n--frontier\r\n\r\n' +
+ '\r\n--__BOUNDARY__\r\n\r\n' +
'Oh hi.' +
- '\r\n--frontier--'
+ '\r\n--__BOUNDARY__--'
)
, method: "PUT"
, multipart:
View
6 tests/test-params.js
@@ -50,13 +50,13 @@ var tests =
}
, testPutMultipart :
{ resp: server.createPostValidator(
- '--frontier\r\n' +
+ '--__BOUNDARY__\r\n' +
'content-type: text/html\r\n' +
'\r\n' +
'<html><body>Oh hi.</body></html>' +
- '\r\n--frontier\r\n\r\n' +
+ '\r\n--__BOUNDARY__\r\n\r\n' +
'Oh hi.' +
- '\r\n--frontier--'
+ '\r\n--__BOUNDARY__--'
)
, method: "PUT"
, multipart:
View
3  tests/test-tunnel.js
@@ -32,9 +32,10 @@ squid.stdout.on('data', function (c) {
})
squid.on('exit', function (c) {
- console.error('exit '+c)
+ console.error('squid: exit '+c)
if (c && !ready) {
console.error('squid must be installed to run this test.')
+ console.error('skipping this test. please install squid and run again if you need to test tunneling.')
c = null
hadError = null
process.exit(0)
Please sign in to comment.
Something went wrong with that request. Please try again.