102 Processing
Used mainly in WebDAV. It tells the client ‘I got your request and I’m working on it, don’t time out just yet!’
When and Why to Use It
Section titled “When and Why to Use It”Rare outside of WebDAV. Use it when an operation will take a very long time, and you want to tell the client ‘I am still working on it, please do not close the connection’.
Usage Examples
Section titled “Usage Examples”import { HttpCode, get } from 'shokupan';
export const getResource = get('/resource', () => { return { message: 'Processing' };}).pipe(HttpCode(102));import { Controller, Get, HttpCode } from 'shokupan';
@Controller('/api')export class ExampleController { @Get('/resource') @HttpCode(102) getResource() { return { message: 'Processing' }; }}import express from 'express';const app = express();
app.get('/resource', (req, res) => { res.status(102).json({ message: 'Processing' });});import { Controller, Get, HttpCode } from '@nestjs/common';
@Controller('api')export class ExampleController { @Get('resource') @HttpCode(102) getResource() { return { message: 'Processing' }; }}import Koa from 'koa';const app = new Koa();
app.use(async ctx => { if (ctx.path === '/resource' && ctx.method === 'GET') { ctx.status = 102; ctx.body = { message: 'Processing' }; }});