koa-lite/test/request/length.js

19 lines
415 B
JavaScript
Raw Permalink Normal View History

2014-07-06 08:43:14 +00:00
'use strict';
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);
})
})