506 Variant Also Negotiates
A server configuration error resulting in an infinite loop while trying to negotiate the right content to return.
When and Why to Use It
Section titled “When and Why to Use It”Use this if your server gets stuck in a recursive loop trying to negotiate which content structure (like language or encoding format) to respond with.
Usage Examples
Section titled “Usage Examples”import { HttpException, get } from 'shokupan';
export const getResource = get('/resource', () => { throw new HttpException('Variant Also Negotiates', 506);});import { Controller, Get, HttpException } from 'shokupan';
@Controller('/api')export class ExampleController { @Get('/resource') getResource() { throw new HttpException('Variant Also Negotiates', 506); }}import express from 'express';const app = express();
app.get('/resource', (req, res) => { res.status(506).json({ error: 'Variant Also Negotiates' });});import { Controller, Get, HttpException } from '@nestjs/common';
@Controller('api')export class ExampleController { @Get('resource') getResource() { throw new HttpException('Variant Also Negotiates', 506); }}import Koa from 'koa';const app = new Koa();
app.use(async ctx => { if (ctx.path === '/resource' && ctx.method === 'GET') { ctx.status = 506; ctx.body = { error: 'Variant Also Negotiates' }; }});