UNPKG

1.91 kBTypeScriptView Raw
1/**
2 * @license
3 * MOST Web Framework 2.0 Codename Blueshift
4 * Copyright (c) 2017, THEMOST LP All rights reserved
5 *
6 * Use of this source code is governed by an BSD-3-Clause license that can be
7 * found in the LICENSE file at https://themost.io/license
8 */
9
10import {IncomingMessage, ServerResponse} from 'http';
11import {HttpApplication} from "./app";
12import {HttpConfiguration} from "./config";
13import {DefaultDataContext} from '@themost/data/data-context';
14
15export declare class HttpContext extends DefaultDataContext {
16
17 constructor(httpRequest : IncomingMessage, httpResponse : ServerResponse);
18 getApplication(): HttpApplication;
19 getConfiguration(): HttpConfiguration;
20 getParam(name : any): any;
21 hasParam(name : any): boolean;
22 init(): void;
23 cookie(name : string, value : any, expires? : Date, domain? : string, cookiePath? : string): void;
24 getCookie(name : string): any;
25 moment(p : any): void;
26 setCookie(name : string, value : any, expires? : Date, domain? : string, cpath? : string): void;
27 setLangCookie(lang : any): void;
28 removeCookie(name : string, domain? : string, cpath? : string): string;
29 unattended(fn : Function, callback : Function): void;
30 culture(value? : string): HttpContext;
31 validateAntiForgeryToken(csrfToken? : string): void;
32 writeFile(file : string): void;
33 is(method : string | Array<any>): boolean;
34 isPost(): boolean;
35 handle(method : string | Array<any>, fn : Function):HttpContext;
36 catch(callback : (() => void) | Function): HttpContext;
37 unhandle(fn : Function): HttpContext;
38 handlePost(fn : Function): HttpContext;
39 handleGet(fn : Function): HttpContext;
40 handlePut(fn : Function): HttpContext;
41 handleDelete(fn : Function): HttpContext;
42 currentHandler(value? : any): HttpContext;
43 translate(...text : string[]): string;
44 engine(extension : string): void;
45 request : IncomingMessage;
46 response: ServerResponse;
47 resolveUrl(appRelativeUrl: string): string;
48}
49