100 Continue
Tells the client ‘Everything is good so far, keep sending your request body.’ Useful for large uploads so the client doesn’t waste time sending data if the headers are rejected.
When and Why to Use It
Section titled “When and Why to Use It”Use this when the client is about to send a massive file (like a 4K video). The client sends the headers first, and you respond with 100 Continue to say ‘Looks good, upload the rest’. This prevents the client from wasting bandwidth if you were going to reject it anyway.
Usage Examples
Section titled “Usage Examples”import { HttpCode, get } from 'shokupan';
export const getResource = get('/resource', () => { return { message: 'Continue' };}).pipe(HttpCode(100));import { Controller, Get, HttpCode } from 'shokupan';
@Controller('/api')export class ExampleController { @Get('/resource') @HttpCode(100) getResource() { return { message: 'Continue' }; }}import express from 'express';const app = express();
app.get('/resource', (req, res) => { res.status(100).json({ message: 'Continue' });});import { Controller, Get, HttpCode } from '@nestjs/common';
@Controller('api')export class ExampleController { @Get('resource') @HttpCode(100) getResource() { return { message: 'Continue' }; }}import Koa from 'koa';const app = new Koa();
app.use(async ctx => { if (ctx.path === '/resource' && ctx.method === 'GET') { ctx.status = 100; ctx.body = { message: 'Continue' }; }});