You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
440 B
22 lines
440 B
4 years ago
|
var Buffer = require('buffer').Buffer
|
||
|
var test = require('tape')
|
||
|
|
||
|
var http = require('../..')
|
||
|
|
||
|
test('authentication', function (t) {
|
||
|
http.get({
|
||
|
path: '/auth',
|
||
|
auth: 'TestUser:trustno1'
|
||
|
}, function (res) {
|
||
|
var buffers = []
|
||
|
|
||
|
res.on('end', function () {
|
||
|
t.ok(new Buffer('You\'re in!').equals(Buffer.concat(buffers)), 'authentication succeeded')
|
||
|
t.end()
|
||
|
})
|
||
|
|
||
|
res.on('data', function (data) {
|
||
|
buffers.push(data)
|
||
|
})
|
||
|
})
|
||
|
})
|