# Class HandlerContext

Class
Module
import { HandlerContext } from "@tsed/common"
Source/packages/common/src/platform/domain/HandlerContext.ts

# Overview

class HandlerContext {
    status: HandlerContextStatus;
    metadata: HandlerMetadata;
    $ctx: PlatformContext;
    err: any;
    args: any[];
<span class="token keyword">constructor</span><span class="token punctuation">(</span><span class="token punctuation">{</span> $ctx<span class="token punctuation">,</span> err<span class="token punctuation">,</span> metadata<span class="token punctuation">,</span> args <span class="token punctuation">}</span><span class="token punctuation">:</span> HandlerContextOptions<span class="token punctuation">)</span><span class="token punctuation">;</span>
get <span class="token function">injector</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <a href="/api/di/services/InjectorService.html"><span class="token">InjectorService</span></a><span class="token punctuation">;</span>
get <span class="token function">container</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">import</span><span class="token punctuation">(</span>"@tsed/di"<span class="token punctuation">)</span>.<a href="/api/di/class/LocalsContainer.html"><span class="token">LocalsContainer</span></a>&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">;</span>
get <span class="token function">request</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> TsED.<a href="/api/common/mvc/decorators/params/Request.html"><span class="token">Request</span></a><span class="token punctuation">;</span>
get <span class="token function">response</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> TsED.<a href="/api/common/mvc/decorators/params/Response.html"><span class="token">Response</span></a><span class="token punctuation">;</span>
get <span class="token function">isDone</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">boolean</span><span class="token punctuation">;</span>

getRequest&lt;T<span class="token punctuation"> = </span><span class="token keyword">any</span>&gt;<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> T<span class="token punctuation">;</span>

getResponse&lt;T<span class="token punctuation"> = </span><span class="token keyword">any</span>&gt;<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> T<span class="token punctuation">;</span>

<span class="token function">callHandler</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> Promise&lt;<span class="token keyword">any</span>&gt;<span class="token punctuation">;</span>
<span class="token function">reject</span><span class="token punctuation">(</span>er<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">void</span><span class="token punctuation">;</span>
<span class="token function">resolve</span><span class="token punctuation">(</span>data?<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">void</span><span class="token punctuation">;</span>
<span class="token function">next</span><span class="token punctuation">(</span>error?<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">void</span><span class="token punctuation">;</span>
<span class="token function">destroy</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">void</span><span class="token punctuation">;</span>
<span class="token function">cancel</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">;</span>
<span class="token function">handle</span><span class="token punctuation">(</span>process<span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">)</span><span class="token punctuation">:</span> <span class="token keyword">any</span><span class="token punctuation">;</span>

}

# Members

status: HandlerContextStatus;

metadata: HandlerMetadata;


err: any;

args: any[];

get injector(): InjectorService;

get container(): import("@tsed/di").LocalsContainer<any>;

get request(): TsED.Request;

get response(): TsED.Response;

get isDone(): boolean;

getRequest<T = any>(): T;

Return the original request instance.


getResponse<T = any>(): T;

Return the original response instance.


callHandler(): Promise<any>;

reject(er: any): void;

resolve(data?: any): void;

next(error?: any): void;

destroy(): void;

cancel(): any;

handle(process: any): any;

Other topics