koa-lite/test/request/type.js

19 lines
427 B
JavaScript
Raw Normal View History

2014-07-06 08:43:14 +00:00
'use strict';
const request = require('../helpers/context').request;
const assert = require('assert');
2014-07-06 08:43:14 +00:00
describe('req.type', () => {
it('should return type void of parameters', () => {
const req = request();
2014-07-06 08:43:14 +00:00
req.header['content-type'] = 'text/html; charset=utf-8';
req.type.should.equal('text/html');
2015-10-12 20:36:41 +00:00
});
2014-07-06 08:43:14 +00:00
2017-04-17 04:02:32 +00:00
it('with no host present', () => {
const req = request();
2015-04-28 17:44:02 +00:00
assert('' === req.type);
2015-10-12 20:36:41 +00:00
});
});