2014-07-06 08:43:14 +00:00
|
|
|
|
2015-10-11 22:59:51 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-05 18:23:47 +00:00
|
|
|
const request = require('../context').request;
|
|
|
|
const assert = require('assert');
|
2014-07-06 08:43:14 +00:00
|
|
|
|
|
|
|
describe('req.inspect()', function(){
|
|
|
|
describe('with no request.req present', function(){
|
|
|
|
it('should return null', function(){
|
2015-10-05 18:23:47 +00:00
|
|
|
const req = request();
|
2014-07-06 08:43:14 +00:00
|
|
|
req.method = 'GET';
|
|
|
|
delete req.req;
|
|
|
|
assert(null == req.inspect());
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should return a json representation', function(){
|
2015-10-05 18:23:47 +00:00
|
|
|
const req = request();
|
2014-07-06 08:43:14 +00:00
|
|
|
req.method = 'GET';
|
|
|
|
req.url = 'example.com';
|
|
|
|
req.header.host = 'example.com';
|
|
|
|
|
|
|
|
req.inspect().should.eql({
|
|
|
|
method: 'GET',
|
|
|
|
url: 'example.com',
|
|
|
|
header: {
|
|
|
|
host: 'example.com'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
|
|
|
})
|