Projektstart
This commit is contained in:
35
backend/node_modules/fastify/test/http2/head.test.js
generated
vendored
Normal file
35
backend/node_modules/fastify/test/http2/head.test.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
'use strict'
|
||||
|
||||
const t = require('tap')
|
||||
const test = t.test
|
||||
const Fastify = require('../..')
|
||||
const h2url = require('h2url')
|
||||
const msg = { hello: 'world' }
|
||||
|
||||
let fastify
|
||||
try {
|
||||
fastify = Fastify({
|
||||
http2: true
|
||||
})
|
||||
t.pass('http2 successfully loaded')
|
||||
} catch (e) {
|
||||
t.fail('http2 loading failed', e)
|
||||
}
|
||||
|
||||
fastify.all('/', function (req, reply) {
|
||||
reply.code(200).send(msg)
|
||||
})
|
||||
|
||||
fastify.listen({ port: 0 }, err => {
|
||||
t.error(err)
|
||||
t.teardown(() => { fastify.close() })
|
||||
|
||||
test('http HEAD request', async (t) => {
|
||||
t.plan(1)
|
||||
|
||||
const url = `http://localhost:${fastify.server.address().port}`
|
||||
const res = await h2url.concat({ url, method: 'HEAD' })
|
||||
|
||||
t.equal(res.headers[':status'], 200)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user