UNPKG

@tsed/platform-express

Version:
21 lines (20 loc) 590 B
import { isArray, isNumber } from "@tsed/core"; import { PlatformResponse } from "@tsed/platform-http"; export class PlatformExpressResponse extends PlatformResponse { cookie(name, value, opts) { super.cookie(name, value, opts); const cookie = this.get("set-cookie"); if (cookie && !isArray(value)) { this.setHeader("set-cookie", [].concat(cookie)); } return this; } end(data) { if (isNumber(data)) { this.raw.send(String(data)); } else { this.raw.send(data); } } }