Skip to content

Commit a40b9d5

Browse files
committed
Fix formatting
1 parent af9356e commit a40b9d5

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

Connection.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ Connection.prototype.startHandshake = function () {
244244
}
245245
this.key = key.toString('base64')
246246
headers = {
247-
'' : 'GET ' + this.path + ' HTTP/1.1',
247+
'': 'GET ' + this.path + ' HTTP/1.1',
248248
'Host': this.host,
249-
'Upgrade' : 'websocket',
249+
'Upgrade': 'websocket',
250250
'Connection': 'Upgrade',
251-
'Sec-WebSocket-Key' : this.key,
252-
'Sec-WebSocket-Version' : '13'
251+
'Sec-WebSocket-Key': this.key,
252+
'Sec-WebSocket-Version': '13'
253253
}
254254

255-
for (var attrname in this.extraHeaders) {
255+
for (var attrname in this.extraHeaders) {
256256
headers[attrname] = this.extraHeaders[attrname]
257257
}
258258

@@ -596,7 +596,7 @@ Connection.prototype.buildHeaders = function (headers) {
596596
var headerString = ''
597597

598598
for (var prop in headers) {
599-
var separator = (prop === '')? '':': '
599+
var separator = (prop === '') ? '' : ': '
600600
var str = prop + separator + headers[prop] + '\r\n'
601601
headerString = headerString + str
602602
}

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function parseWSURL(URL) {
8181

8282
parts.protocol = parts.protocol || 'ws:'
8383
if (parts.protocol === 'ws:') {
84-
secure = false
84+
secure = false
8585
} else if (parts.protocol === 'wss:') {
8686
secure = true
8787
} else {

test/test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var name = 'test'
1111
var password = 'test123'
1212
var options = {
1313
extraHeaders: {
14-
Authorization: 'Basic ' + new Buffer(name+ ':' + password).toString('base64')
14+
Authorization: 'Basic ' + new Buffer(name + ':' + password).toString('base64')
1515
}
1616
}
1717

@@ -21,7 +21,7 @@ describe('extraHeaders', function () {
2121
testServer = ws.createServer(function (conn) {
2222
testConn = conn
2323
}).listen(TEST_PORT, function () {
24-
testClient = ws.connect('ws://localhost:' + TEST_PORT,options, done)
24+
testClient = ws.connect('ws://localhost:' + TEST_PORT, options, done)
2525
})
2626
})
2727

@@ -32,26 +32,26 @@ describe('extraHeaders', function () {
3232

3333
it('should create a headerString with extra header options', function (done) {
3434
var client = getClient(),
35-
string = 'GET '+ client.path +' HTTP/1.1\r\nHost: '+client.host+'\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: '+client.key+'\r\nSec-WebSocket-Version: 13\r\nAuthorization: Basic ' + new Buffer(name+ ':' + password).toString('base64') +'\r\n\r\n'
35+
string = 'GET ' + client.path + ' HTTP/1.1\r\nHost: ' + client.host + '\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: ' + client.key + '\r\nSec-WebSocket-Version: 13\r\nAuthorization: Basic ' + new Buffer(name + ':' + password).toString('base64') + '\r\n\r\n'
3636

3737
var headers = {
38-
'' : 'GET ' + client.path + ' HTTP/1.1',
38+
'': 'GET ' + client.path + ' HTTP/1.1',
3939
'Host': client.host,
40-
'Upgrade' : 'websocket',
40+
'Upgrade': 'websocket',
4141
'Connection': 'Upgrade',
42-
'Sec-WebSocket-Key' : client.key,
43-
'Sec-WebSocket-Version' : '13'
42+
'Sec-WebSocket-Key': client.key,
43+
'Sec-WebSocket-Version': '13'
4444
}
4545

46-
headers.Authorization = 'Basic ' + new Buffer(name+ ':' + password).toString('base64')
46+
headers.Authorization = 'Basic ' + new Buffer(name + ':' + password).toString('base64')
4747

4848
var buildstring = client.buildHeaders(headers)
4949

5050
if (string === buildstring) {
5151
done()
5252
}
53-
54-
})
53+
54+
})
5555
})
5656

5757
describe('text frames', function () {

0 commit comments

Comments
 (0)