Buckets:
| const { test } = require('node:test') | |
| const Fastify = require('..') | |
| const maxHeaderSize = 1024 | |
| test('Should return 431 if request header fields are too large', async (t) => { | |
| t.plan(2) | |
| const fastify = Fastify({ http: { maxHeaderSize } }) | |
| fastify.route({ | |
| method: 'GET', | |
| url: '/', | |
| handler: (_req, reply) => { | |
| reply.send({ hello: 'world' }) | |
| } | |
| }) | |
| const fastifyServer = await fastify.listen({ port: 0 }) | |
| const result = await fetch(fastifyServer, { | |
| method: 'GET', | |
| headers: { | |
| 'Large-Header': 'a'.repeat(maxHeaderSize) | |
| } | |
| }) | |
| t.assert.ok(!result.ok) | |
| t.assert.strictEqual(result.status, 431) | |
| t.after(() => fastify.close()) | |
| }) | |
| test('Should return 431 if URI is too long', async (t) => { | |
| t.plan(2) | |
| const fastify = Fastify({ http: { maxHeaderSize } }) | |
| fastify.route({ | |
| method: 'GET', | |
| url: '/', | |
| handler: (_req, reply) => { | |
| reply.send({ hello: 'world' }) | |
| } | |
| }) | |
| const fastifyServer = await fastify.listen({ port: 0 }) | |
| const result = await fetch(`${fastifyServer}/${'a'.repeat(maxHeaderSize)}`) | |
| t.assert.ok(!result.ok) | |
| t.assert.strictEqual(result.status, 431) | |
| t.after(() => fastify.close()) | |
| }) | |
Xet Storage Details
- Size:
- 1.2 kB
- Xet hash:
- e06d8826c9ef4836c13af8b542210c98daaf3c39b709f49220815317b9f50661
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.