300 Multiple Choices
There are multiple options available for the requested link. Pick one! Useful for serving a video in different formats.
When and Why to Use It
Section titled “When and Why to Use It”Use this when the client requests a URL that could resolve to multiple different things. For example, requesting a video that is available in 1080p, 720p, or 480p, and letting the client choose.
Usage Examples
Section titled “Usage Examples”import { HttpCode, get } from 'shokupan';
export const getResource = get('/resource', () => { return { message: 'Multiple Choices' };}).pipe(HttpCode(300));import { Controller, Get, HttpCode } from 'shokupan';
@Controller('/api')export class ExampleController { @Get('/resource') @HttpCode(300) getResource() { return { message: 'Multiple Choices' }; }}import express from 'express';const app = express();
app.get('/resource', (req, res) => { res.status(300).json({ message: 'Multiple Choices' });});import { Controller, Get, HttpCode } from '@nestjs/common';
@Controller('api')export class ExampleController { @Get('resource') @HttpCode(300) getResource() { return { message: 'Multiple Choices' }; }}import Koa from 'koa';const app = new Koa();
app.use(async ctx => { if (ctx.path === '/resource' && ctx.method === 'GET') { ctx.status = 300; ctx.body = { message: 'Multiple Choices' }; }});