koa-lite/test/request/length.js

17 lines
400 B
JavaScript
Raw Normal View History

2014-07-06 08:43:14 +00:00
var request = require('../context').request;
2014-11-16 13:52:14 +00:00
var assert = require('assert');
2014-07-06 08:43:14 +00:00
describe('ctx.length', function(){
it('should return length in content-length', function(){
var req = request();
req.header['content-length'] = '10';
req.length.should.equal(10);
})
describe('with no content-length present', function(){
var req = request();
assert(null == req.length);
})
})