blob: 5c731154db15b1b26aed55c0d0ed314be8b040ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
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)
})
})
})
|