增加response原生对象属性

master
yutent 2025-01-07 15:56:38 +08:00
parent cfb8c7d553
commit 1a16c23ced
2 changed files with 7 additions and 1 deletions

4
index.d.ts vendored
View File

@ -1,9 +1,11 @@
import { IncomingMessage, ServerResponse } from 'http' import { IncomingMessage, ServerResponse } from 'http'
export default class Response { export default class Response {
constructor(req: IncomingMessage, res: ServerResponse)
status: number status: number
constructor(req: IncomingMessage, res: ServerResponse) get response(): ServerResponse
get ended(): boolean get ended(): boolean

View File

@ -24,6 +24,10 @@ export default class Response {
this.#ended = !!res.ended this.#ended = !!res.ended
} }
get response() {
return this.#res
}
get ended() { get ended() {
return this.#ended return this.#ended
} }