Adding a headers setter to match the request api in the response api
Hi,
In a matter of consistency, I wish to be able to use a headers setter on the response, like I would on a request.
Thanks
PS: Koa is amazing, thank you guys
Codecov Report
Merging #1237 into master will not change coverage. The diff coverage is
100%.
@@ Coverage Diff @@
## master #1237 +/- ##
======================================
Coverage 100% 100%
======================================
Files 5 5
Lines 391 392 +1
======================================
+ Hits 391 392 +1
| Impacted Files | Coverage Δ | |
|---|---|---|
| lib/response.js | 100% <100%> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 2180839...b91d595. Read the comment docs.
-0 for me, I'd not like to add a duplicate API, and most of users are already used to set header with response.set(headers)
I'm +/-0 also.
I can see how res.headers = is expected usage.
If anything maybe we can freeze the res object from properties that are not in use by koa to avoid confusion? Probably a very breaking change found at runtime sadly.
I know that adding a duplicate API seems useless, but there is already one in the Request (headers is just calling header) ... I personnaly think that consistency should be preserved between the two APIs (adding set/get methods to Request is fine too). Having this would make things more obvious ...