@whi/cf-routing - v0.2.0
    Preparing search index...

    Class ResponseContext

    ResponseContext provides a mutable interface for customizing response properties before the final Response is constructed.

    The API mirrors the Response object for familiarity, but allows mutation since the actual Response is built after the handler completes.

    class UserHandler extends RouteHandler<Env, { id: string }> {
    async get(request: Request, env: Env, params?: { id: string }): Promise<any> {
    this.response.status = 201;
    this.response.headers.set('Set-Cookie', 'session=abc123');
    return { userId: params.id };
    }
    }
    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    status: number = 200

    HTTP status code for the response

    200
    
    statusText: string = 'OK'

    HTTP status text for the response

    'OK'
    
    headers: Headers

    Headers to include in the response Works like Response.headers - use .set(), .append(), .delete(), etc.

    Methods