koa-lite/test/request/type.js

19 lines
431 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';
2017-05-11 03:30:32 +00:00
assert.equal(req.type, '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();
2017-05-11 03:30:32 +00:00
assert.equal(req.type, '');
2015-10-12 20:36:41 +00:00
});
});