431 Request Header Fields Too Large
Either an individual header or all headers collectively are too huge. Often caused by having a massive amount of cookies.
When and Why to Use It
Section titled “When and Why to Use It”Use this if the client is sending cookies so massive that they threaten to crash your header parser.
Usage Examples
Section titled “Usage Examples”import { HttpException, get } from 'shokupan';
export const getResource = get('/resource', () => { throw new HttpException('Request Header Fields Too Large', 431);});import { Controller, Get, HttpException } from 'shokupan';
@Controller('/api')export class ExampleController { @Get('/resource') getResource() { throw new HttpException('Request Header Fields Too Large', 431); }}import express from 'express';const app = express();
app.get('/resource', (req, res) => { res.status(431).json({ error: 'Request Header Fields Too Large' });});import { Controller, Get, HttpException } from '@nestjs/common';
@Controller('api')export class ExampleController { @Get('resource') getResource() { throw new HttpException('Request Header Fields Too Large', 431); }}import Koa from 'koa';const app = new Koa();
app.use(async ctx => { if (ctx.path === '/resource' && ctx.method === 'GET') { ctx.status = 431; ctx.body = { error: 'Request Header Fields Too Large' }; }});