/// import { Cookie } from './cookie'; import { StaticService } from './static_service'; import { Session } from './session'; import * as http from 'http'; import { IncomingForm, IFileStream } from './incoming_form'; import { RuleResult } from './router'; /** * @class HttpService * @bases staticService::StaticService */ export declare class HttpService extends StaticService { private m_cookie; private m_session; private _id; private _st; /** * @func markReturnInvalid() mark action return invalid */ markReturnInvalid(): void; /** * site cookie * @type {Cookie} */ get cookie(): Cookie; get session(): Session; /** * ajax jsonp callback name * @tpye {String} */ readonly jsonpCallback: string; /** * post form * @type {IncomingForm} */ form: IncomingForm | null; /** * post form data * @type {Object} */ readonly data: Dict; /** * @constructor * @arg req {http.IncomingMessage} * @arg res {http.ServerResponse} */ constructor(req: http.IncomingMessage, res: http.ServerResponse); /** * @overwrite */ onOptionsRequest(rule: RuleResult): void; /** * @overwrite */ onAction(rule: RuleResult): Promise; /** * @func onIncomingForm(info) 传入表单 */ onIncomingForm(rule: RuleResult): IncomingForm; /** * @func hasAcceptFilestream(info) 接收文件流 */ onAcceptFilestream(path: string, name: string, type: string): IFileStream | null; /** * @func auth(info) */ onAuth(rule: RuleResult): Promise | boolean; /** * @fun returnData() return data to browser * @arg type {String} # MIME type * @arg data {Object} # data */ returnData(type: string, data: any): void; /** * @fun returnString # return string to browser * @arg type {String} # MIME type * @arg str {String} */ returnString(str: string, type?: string): void; /** * @fun returnHtml # return html to browser * @arg html {String} */ returnHtml(html: string): void; /** * @fun rev # return data to browser * @arg data {JSON} */ returnJSON(data: any): void; /** * @fun rev # return data to browser * @arg data {JSON} */ returnJSONNoWrap(data: any): void; /** * @fun returnError() return error to browser * @arg [err] {Error} */ returnError(err: any): void; /** * @func returnJSONError(err) */ returnJSONError(err: any): void; /** * @func returnHtmlError() */ returnHtmlError(err: any): void; } /** * @class HttpService */ export declare class Descriptors extends HttpService { descriptors(): Dict; }