Skip to content

Commit

Permalink
Updated standard
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Aug 29, 2018
1 parent 7c2ea0f commit ffd0127
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -39,7 +39,7 @@
"bl": "^2.0.1",
"pre-commit": "^1.1.2",
"split2": "^3.0.0",
"standard": "^11.0.0",
"standard": "^12.0.0",
"tap": "^12.0.1"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion test/cli-ipc.test.js
Expand Up @@ -40,7 +40,7 @@ const socketPath = win
? path.join('\\\\?\\pipe', process.cwd(), 'autocannon-' + Date.now())
: path.join(os.tmpdir(), 'autocannon-' + Date.now() + '.sock')

helper.startServer({socketPath})
helper.startServer({ socketPath })

const child = childProcess.spawn(process.execPath, [path.join(__dirname, '..'), '-d', '1', '-S', socketPath, 'example.com/foo'], {
cwd: __dirname,
Expand Down
2 changes: 1 addition & 1 deletion test/helper.js
Expand Up @@ -33,7 +33,7 @@ function startTrailerServer () {
function handle (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain', 'Trailer': 'Content-MD5' })
res.write('hello ')
res.addTrailers({'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667'})
res.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' })
res.end('world')
}

Expand Down
8 changes: 4 additions & 4 deletions test/httpClient.test.js
Expand Up @@ -239,7 +239,7 @@ test('client supports changing the headers', (t) => {
Buffer.from(`POST / HTTP/1.1\r\nHost: localhost:${server.address().port}\r\nConnection: keep-alive\r\n\r\n`),
'request is okay before modifying')

client.setHeaders({header: 'modified'})
client.setHeaders({ header: 'modified' })

t.same(client.getRequestBuffer(),
Buffer.from(`POST / HTTP/1.1\r\nHost: localhost:${server.address().port}\r\nConnection: keep-alive\r\nheader: modified\r\n\r\n`),
Expand All @@ -261,7 +261,7 @@ test('client supports changing the headers and body', (t) => {
'request is okay before modifying')

client.setBody('modified')
client.setHeaders({header: 'modifiedHeader'})
client.setHeaders({ header: 'modifiedHeader' })

t.same(client.getRequestBuffer(),
Buffer.from(`POST / HTTP/1.1\r\nHost: localhost:${server.address().port}\r\nConnection: keep-alive\r\nheader: modifiedHeader\r\nContent-Length: 8\r\n\r\nmodified\r\n`),
Expand All @@ -282,7 +282,7 @@ test('client supports changing the headers and body together', (t) => {
Buffer.from(`POST / HTTP/1.1\r\nHost: localhost:${server.address().port}\r\nConnection: keep-alive\r\nContent-Length: 11\r\n\r\nhello world\r\n`),
'request is okay before modifying')

client.setHeadersAndBody({header: 'modifiedHeader'}, 'modified')
client.setHeadersAndBody({ header: 'modifiedHeader' }, 'modified')

t.same(client.getRequestBuffer(),
Buffer.from(`POST / HTTP/1.1\r\nHost: localhost:${server.address().port}\r\nConnection: keep-alive\r\nheader: modifiedHeader\r\nContent-Length: 8\r\n\r\nmodified\r\n`),
Expand Down Expand Up @@ -322,7 +322,7 @@ test('client customiseRequest function overwrites the headers and body', (t) =>
t.ok(client.setHeaders, 'client had setHeaders method')
t.ok(client.setBody, 'client had setBody method')

client.setHeadersAndBody({header: 'modifiedHeader'}, 'modified')
client.setHeadersAndBody({ header: 'modifiedHeader' }, 'modified')
}

const client = new Client(opts)
Expand Down
6 changes: 3 additions & 3 deletions test/httpRequestBuilder.test.js
Expand Up @@ -41,7 +41,7 @@ test('request builder should allow per build overwriting', (t) => {

const build = RequestBuilder(opts)

const result = build({method: 'GET'})
const result = build({ method: 'GET' })

t.same(result,
Buffer.from(`GET / HTTP/1.1\r\nHost: localhost:${server.address().port}\r\nConnection: keep-alive\r\n\r\n`),
Expand All @@ -55,7 +55,7 @@ test('request builder should throw on unknown http method', (t) => {

const build = RequestBuilder(opts)

t.throws(() => build({method: 'UNKNOWN'}))
t.throws(() => build({ method: 'UNKNOWN' }))
})

test('request builder should accept all valid standard http methods', (t) => {
Expand All @@ -65,7 +65,7 @@ test('request builder should accept all valid standard http methods', (t) => {

const build = RequestBuilder(opts)

t.doesNotThrow(() => build({method: method}), `${method} should be usable by the request builded`)
t.doesNotThrow(() => build({ method: method }), `${method} should be usable by the request builded`)
})
t.end()
})
Expand Down
2 changes: 1 addition & 1 deletion test/requestIterator.test.js
Expand Up @@ -138,7 +138,7 @@ test('request iterator should allow for rebuilding the current request', (t) =>
t.same(iterator.currentRequest.requestBuffer, request3Res, 'request was okay')
iterator.nextRequest()
t.same(iterator.currentRequest.requestBuffer, request2Res, 'request was okay')
iterator.setHeaders({header: 'modifiedHeader'})
iterator.setHeaders({ header: 'modifiedHeader' })
t.same(iterator.currentRequest.requestBuffer, request4Res, 'request was okay')
iterator.setRequest() // this should build default request
t.same(iterator.currentRequest.requestBuffer, request5Res, 'request was okay')
Expand Down
2 changes: 1 addition & 1 deletion test/run.test.js
Expand Up @@ -257,7 +257,7 @@ test('run should accept a unix socket/windows pipe', (t) => {
? path.join('\\\\?\\pipe', process.cwd(), 'autocannon-' + Date.now())
: path.join(os.tmpdir(), 'autocannon-' + Date.now() + '.sock')

helper.startServer({socketPath})
helper.startServer({ socketPath })

run({
url: 'localhost',
Expand Down

0 comments on commit ffd0127

Please sign in to comment.