Skip to content

Commit

Permalink
Merge pull request #1337 from nylen/standardize-test-ports
Browse files Browse the repository at this point in the history
Standardize test ports on 6767
  • Loading branch information
nylen committed Jan 9, 2015
2 parents 6931942 + a849e15 commit 2100b49
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions tests/test-form-data.js
Expand Up @@ -58,7 +58,7 @@ function runTest(t, json) {
t.ok( data.indexOf('form-data; name="batch"') !== -1 )
t.ok( data.match(/form-data; name="batch"/g).length === 2 )

// check for http://localhost:8080/file traces
// check for http://localhost:6767/file traces
t.ok( data.indexOf('Photoshop ICC') !== -1 )
t.ok( data.indexOf('Content-Type: ' + mime.lookup(remoteFile) ) !== -1 )

Expand All @@ -67,13 +67,13 @@ function runTest(t, json) {
})
})

server.listen(8080, function() {
server.listen(6767, function() {

// @NOTE: multipartFormData properties must be set here so that my_file read stream does not leak in node v0.8
multipartFormData.my_field = 'my_value'
multipartFormData.my_buffer = new Buffer([1, 2, 3])
multipartFormData.my_file = fs.createReadStream(localFile)
multipartFormData.remote_file = request('http://localhost:8080/file')
multipartFormData.remote_file = request('http://localhost:6767/file')
multipartFormData.secret_file = {
value: fs.createReadStream(localFile),
options: {
Expand All @@ -87,7 +87,7 @@ function runTest(t, json) {
]

var reqOptions = {
url: 'http://localhost:8080/upload',
url: 'http://localhost:6767/upload',
formData: multipartFormData
}
if (json) {
Expand Down
8 changes: 4 additions & 4 deletions tests/test-form.js
Expand Up @@ -55,7 +55,7 @@ tape('multipart form append', function(t) {
field = FIELDS.shift()
t.ok( data.indexOf('form-data; name="' + field.name + '"') !== -1 )
t.ok( data.indexOf('; filename="' + path.basename(field.value.path) + '"') !== -1 )
// check for http://localhost:8080/file traces
// check for http://localhost:6767/file traces
t.ok( data.indexOf('Photoshop ICC') !== -1 )
t.ok( data.indexOf('Content-Type: ' + mime.lookup(remoteFile) ) !== -1 )

Expand All @@ -68,16 +68,16 @@ tape('multipart form append', function(t) {
})
})

server.listen(8080, function() {
server.listen(6767, function() {

FIELDS = [
{ name: 'my_field', value: 'my_value' },
{ name: 'my_buffer', value: new Buffer([1, 2, 3]) },
{ name: 'my_file', value: fs.createReadStream(localFile) },
{ name: 'remote_file', value: request('http://localhost:8080/file') }
{ name: 'remote_file', value: request('http://localhost:6767/file') }
]

var req = request.post('http://localhost:8080/upload', function(err, res, body) {
var req = request.post('http://localhost:6767/upload', function(err, res, body) {
t.equal(err, null)
t.equal(res.statusCode, 200)
t.equal(body, 'done')
Expand Down
8 changes: 4 additions & 4 deletions tests/test-multipart.js
Expand Up @@ -60,7 +60,7 @@ function runTest(t, a) {

// 4th field : remote_file
t.ok( data.indexOf('name: remote_file') !== -1 )
// check for http://localhost:8080/file traces
// check for http://localhost:6767/file traces
t.ok( data.indexOf('Photoshop ICC') !== -1 )
}

Expand All @@ -69,23 +69,23 @@ function runTest(t, a) {
})
})

server.listen(8080, function() {
server.listen(6767, function() {

// @NOTE: multipartData properties must be set here so that my_file read stream does not leak in node v0.8
multipartData = chunked
? [
{name: 'my_field', body: 'my_value'},
{name: 'my_buffer', body: new Buffer([1, 2, 3])},
{name: 'my_file', body: fs.createReadStream(localFile)},
{name: 'remote_file', body: request('http://localhost:8080/file')}
{name: 'remote_file', body: request('http://localhost:6767/file')}
]
: [
{name: 'my_field', body: 'my_value'},
{name: 'my_buffer', body: new Buffer([1, 2, 3])}
]

var reqOptions = {
url: 'http://localhost:8080/upload',
url: 'http://localhost:6767/upload',
headers: (function () {
var headers = {}
if (a.mixed) {
Expand Down
4 changes: 2 additions & 2 deletions tests/test-piped-redirect.js
Expand Up @@ -4,8 +4,8 @@ var http = require('http')
, request = require('../index')
, tape = require('tape')

var port1 = 8968
, port2 = 8969
var port1 = 6767
, port2 = 6768

var s1 = http.createServer(function(req, resp) {
if (req.url === '/original') {
Expand Down
4 changes: 2 additions & 2 deletions tests/test-rfc3986.js
Expand Up @@ -40,9 +40,9 @@ function runTest (t, options) {
})
})

server.listen(8080, function() {
server.listen(6767, function() {

request.post('http://localhost:8080', options, function(err, res, body) {
request.post('http://localhost:6767', options, function(err, res, body) {
t.equal(err, null)
server.close(function() {
t.end()
Expand Down

0 comments on commit 2100b49

Please sign in to comment.