download
raw
1.05 kB
const acceptHostStrategy = require('../lib/strategies/accept-host')
const { test } = require('node:test')
test('can get hosts by exact matches', async (t) => {
const storage = acceptHostStrategy.storage()
t.assert.equal(storage.get('fastify.io'), undefined)
storage.set('fastify.io', true)
t.assert.equal(storage.get('fastify.io'), true)
})
test('can get hosts by regexp matches', async (t) => {
const storage = acceptHostStrategy.storage()
t.assert.equal(storage.get('fastify.io'), undefined)
storage.set(/.+fastify\.io/, true)
t.assert.equal(storage.get('foo.fastify.io'), true)
t.assert.equal(storage.get('bar.fastify.io'), true)
})
test('exact host matches take precendence over regexp matches', async (t) => {
const storage = acceptHostStrategy.storage()
storage.set(/.+fastify\.io/, 'wildcard')
storage.set('auth.fastify.io', 'exact')
t.assert.equal(storage.get('foo.fastify.io'), 'wildcard')
t.assert.equal(storage.get('bar.fastify.io'), 'wildcard')
t.assert.equal(storage.get('auth.fastify.io'), 'exact')
})

Xet Storage Details

Size:
1.05 kB
·
Xet hash:
b00c7eb2ef92d00f7f52f23d8a212d9276ffe6db04b9e4e32f9098ee4657feda

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