Skip to content

Commit

Permalink
testing reply with file and header for issue #182
Browse files Browse the repository at this point in the history
  • Loading branch information
pgte committed Aug 7, 2014
1 parent bb7125c commit 5831b5c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/test_intercept.js
Expand Up @@ -15,6 +15,7 @@ var restify = require('restify');
var domain = require('domain');
var hyperquest = require('hyperquest');


test("double activation throws exception", function(t) {
nock.restore();
t.false(nock.isActive());
Expand Down Expand Up @@ -918,6 +919,37 @@ test("reply with file and pipe response", function(t) {

});

test("reply with file with headers", function(t) {
var dataCalled = false

var scope = nock('http://www.filereplier2.com')
.get('/')
.replyWithFile(200, __dirname + '/../assets/reply_file_2.txt.gz', {
'content-type': 'gzip'
});

var req = http.request({
host: "www.filereplier2.com"
, path: '/'
, port: 80
}, function(res) {

t.equal(res.statusCode, 200);
res.on('end', function() {
t.ok(dataCalled);
t.end();
});
res.on('data', function(data) {
dataCalled = true;
t.equal(data.length, 57);
});

});

req.end();

});

test("reply with file with mikeal/request", function(t) {
var scope = nock('http://www.files.com')
.get('/')
Expand Down

0 comments on commit 5831b5c

Please sign in to comment.