Skip to content

Commit

Permalink
NextApiResponse: setHeader() and writeHead() should return this (#144)
Browse files Browse the repository at this point in the history
* setHeader() and writeHead() should return `this`

* Sync

---------

Co-authored-by: Frank <[email protected]>
  • Loading branch information
Tietew and fwang authored Jun 27, 2023
1 parent d6db51f commit b5a4c0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/twenty-hounds-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"open-next": patch
---

Response: setHeader() and writeHead() return "this"
3 changes: 2 additions & 1 deletion packages/open-next/src/adapters/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class ServerResponse extends http.ServerResponse {
} else {
super.setHeader(key, value);
}
return this;
}

writeHead(statusCode, reason, obj) {
Expand All @@ -85,7 +86,7 @@ export class ServerResponse extends http.ServerResponse {
}
}

super.writeHead(statusCode, reason, obj);
return super.writeHead(statusCode, reason, obj);
}

constructor({ method }) {
Expand Down

1 comment on commit b5a4c0c

@vercel
Copy link

@vercel vercel bot commented on b5a4c0c Jun 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

open-next – ./

open-next-git-main-sst-dev.vercel.app
open-next.vercel.app
open-next-sst-dev.vercel.app

Please sign in to comment.