Skip to content

Commit

Permalink
fix: return this when calling setHeader, end and destroy (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Dec 1, 2021
1 parent d97d6f7 commit 4ac95fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/runtime/node/http/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ export class ServerResponse extends Writable implements http.ServerResponse {
return this
}

setHeader (name: string, value: number | string | ReadonlyArray<string>): void {
setHeader (name: string, value: number | string | ReadonlyArray<string>): this {
this._headers[name.toLowerCase()] = value + ''
return this
}

getHeader (name: string): number | string | string[] | undefined {
Expand Down
4 changes: 4 additions & 0 deletions src/runtime/node/stream/writable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export class Writable extends EventEmitter implements stream.Writable {
this.writableFinished = true
this.emit('close')
this.emit('finish')
// TODO: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/57473
return this as unknown as void
}

cork (): void {
Expand All @@ -78,5 +80,7 @@ export class Writable extends EventEmitter implements stream.Writable {
this.destroyed = true
delete this._data
this.removeAllListeners()
// TODO: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/57473
return this as unknown as void
}
}

0 comments on commit 4ac95fd

Please sign in to comment.