download
raw
925 Bytes
'use strict'
const { test } = require('node:test')
const FindMyWay = require('../..')
test('A route supports host constraints under http2 protocol', t => {
t.plan(3)
const findMyWay = FindMyWay()
findMyWay.on('GET', '/', {}, (req, res) => {
t.assert.assert.fail()
})
findMyWay.on('GET', '/', { constraints: { host: 'fastify.io' } }, (req, res) => {
t.assert.equal(req.headers[':authority'], 'fastify.io')
})
findMyWay.on('GET', '/', { constraints: { host: /.+\.de/ } }, (req, res) => {
t.assert.ok(req.headers[':authority'].endsWith('.de'))
})
findMyWay.lookup({
method: 'GET',
url: '/',
headers: {
':authority': 'fastify.io'
}
})
findMyWay.lookup({
method: 'GET',
url: '/',
headers: {
':authority': 'fastify.de'
}
})
findMyWay.lookup({
method: 'GET',
url: '/',
headers: {
':authority': 'find-my-way.de'
}
})
})

Xet Storage Details

Size:
925 Bytes
·
Xet hash:
d8a1cccfd9c627d1033796a5c674f89d5d7045be79f3bce049754de10748d4ab

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.