451 Unavailable For Legal Reasons
The server legally cannot show you this content (e.g. court order or government censorship). The number references the book Fahrenheit 451.
When and Why to Use It
Section titled “When and Why to Use It”Use this if you receive a DMCA takedown or a government mandate blocking specific content, and you want to be totally transparent about why it’s blocked.
Usage Examples
Section titled “Usage Examples”import { HttpException, get } from 'shokupan';
export const getResource = get('/resource', () => { throw new HttpException('Unavailable For Legal Reasons', 451);});import { Controller, Get, HttpException } from 'shokupan';
@Controller('/api')export class ExampleController { @Get('/resource') getResource() { throw new HttpException('Unavailable For Legal Reasons', 451); }}import express from 'express';const app = express();
app.get('/resource', (req, res) => { res.status(451).json({ error: 'Unavailable For Legal Reasons' });});import { Controller, Get, HttpException } from '@nestjs/common';
@Controller('api')export class ExampleController { @Get('resource') getResource() { throw new HttpException('Unavailable For Legal Reasons', 451); }}import Koa from 'koa';const app = new Koa();
app.use(async ctx => { if (ctx.path === '/resource' && ctx.method === 'GET') { ctx.status = 451; ctx.body = { error: 'Unavailable For Legal Reasons' }; }});