2014-07-06 08:43:14 +00:00
|
|
|
|
2015-10-11 22:59:51 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-12 04:59:30 +00:00
|
|
|
const request = require('../helpers/context').request;
|
2015-10-05 18:23:47 +00:00
|
|
|
const assert = require('assert');
|
2014-07-06 08:43:14 +00:00
|
|
|
|
2015-10-25 07:54:57 +00:00
|
|
|
describe('ctx.length', () => {
|
|
|
|
it('should return length in content-length', () => {
|
2015-10-05 18:23:47 +00:00
|
|
|
const req = request();
|
2014-07-06 08:43:14 +00:00
|
|
|
req.header['content-length'] = '10';
|
2017-05-11 03:30:32 +00:00
|
|
|
assert.equal(req.length, 10);
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
2014-07-06 08:43:14 +00:00
|
|
|
|
2017-04-20 02:43:06 +00:00
|
|
|
it('with no content-length present', () => {
|
2015-10-05 18:23:47 +00:00
|
|
|
const req = request();
|
2017-05-11 03:30:32 +00:00
|
|
|
assert.equal(req.length, undefined);
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
|
|
|
});
|