-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
get.js
17 lines (15 loc) · 625 Bytes
/
get.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict'
const assert = require('assert')
const context = require('../../test-helpers/context')
describe('ctx.get(name)', () => {
it('should return the field value', () => {
const ctx = context()
ctx.req.headers.host = 'http:https://google.com'
ctx.req.headers.referer = 'http:https://google.com'
assert.strictEqual(ctx.get('HOST'), 'http:https://google.com')
assert.strictEqual(ctx.get('Host'), 'http:https://google.com')
assert.strictEqual(ctx.get('host'), 'http:https://google.com')
assert.strictEqual(ctx.get('referer'), 'http:https://google.com')
assert.strictEqual(ctx.get('referrer'), 'http:https://google.com')
})
})