UNPKG

nxkit

Version:

This is a collection of tools, independent of any other libraries

49 lines (48 loc) 1.44 kB
/// <reference types="node" /> import { IncomingMessage, ServerResponse } from 'http'; export declare class ReadCookie { private _req; constructor(req: IncomingMessage); /** * 根据名字取Cookie值 * @param {String} name cookie的名称 * @return {String} 返回cookie值 */ get(name: string): string | null; /** * 获取全部Cookie * @return {Object} 返回cookie值 */ getAll(): Dict<any>; } export declare class Cookie extends ReadCookie { private _res; /** * 构造函数 * @param {http.ServerResponse} req * @param {http.ServerResponse} res * @constructor */ constructor(req: IncomingMessage, res: ServerResponse); /** * 设置cookie值 * @param {String} name 名称 * @param {String} value 值 * @param {Date} expires (Optional) 过期时间 * @param {String} path (Optional) * @param {String} domain (Optional) * @param {Boolran} secure (Optional) */ set(name: string, value: string | number | boolean, expires?: Date, path?: string, domain?: string, secure?: boolean): void; /** * 删除一个cookie * @param {String} name 名称 * @param {String} path (Optional) * @param {String} domain (Optional) */ remove(name: string, path?: string, domain?: string): void; /** * 删除全部cookie */ delAll(): void; }