419 Page Expired
An unofficial code (popularized by Laravel) used to indicate a missing or expired CSRF token.
When and Why to Use It
Section titled “When and Why to Use It”Use this if your framework supports CSRF protection, and a form submission is rejected because the security token has expired.
Usage Examples
Section titled “Usage Examples”import { HttpException, get } from 'shokupan';
export const getResource = get('/resource', () => { throw new HttpException('Page Expired', 419);});import { Controller, Get, HttpException } from 'shokupan';
@Controller('/api')export class ExampleController { @Get('/resource') getResource() { throw new HttpException('Page Expired', 419); }}import express from 'express';const app = express();
app.get('/resource', (req, res) => { res.status(419).json({ error: 'Page Expired' });});import { Controller, Get, HttpException } from '@nestjs/common';
@Controller('api')export class ExampleController { @Get('resource') getResource() { throw new HttpException('Page Expired', 419); }}import Koa from 'koa';const app = new Koa();
app.use(async ctx => { if (ctx.path === '/resource' && ctx.method === 'GET') { ctx.status = 419; ctx.body = { error: 'Page Expired' }; }});