Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
http: enable setHeader for call chaining#35924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Conversation
PoojaDurgad commented Nov 2, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot commented Nov 2, 2020
Review requested:
|
mscdex commented Nov 2, 2020
The targeted subsystem can just be |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
lpinca commented Nov 2, 2020
Can you please add a test? |
lpinca left a comment • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with the test file as is but it could be simplified to something like
'use strict';require('../common');constassert=require('assert');const{ ServerResponse }=require('http');constresponse=newServerResponse({method: 'GET',httpVersionMajor: 1,httpVersionMinor: 1});assert.strictEqual(response.setHeader('foo','bar'),response);or just a single assertion like the one above in an already existing test where response.setHeader() is used.
There is no need to start a server and chaining is a logical consequence of returning the same object.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot commented Nov 5, 2020
nodejs-github-bot commented Nov 5, 2020
Trott commented Nov 5, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Nit on the commit message. Maybe this is a little more clear?: |
nodejs-github-bot commented Nov 5, 2020
Trott commented Nov 5, 2020
Will this automatically add this for |
Trott commented Nov 5, 2020
PoojaDurgad commented Nov 5, 2020
@Trott - This behavior will be added to the |
Trott commented Nov 6, 2020
Benchmark results show a small performance hit in some cases. Probably acceptable? @nodejs/http |
PoojaDurgad commented Nov 27, 2020
is there anything pending on this PR? if yes let me know . |
nodejs-github-bot commented Nov 28, 2020
Trott commented Nov 30, 2020
Landed in dedd061 |
Make `response.setHeader` return the response object itself so that multiple header setting can be chained. Fixes: #33148 PR-URL: #35924 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ricky Zhou <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #36435 Notable changes: * child_processes: * add AbortSignal support (Benjamin Gruenbaum) (#36308) * deps: * update ICU to 68.1 (Michaël Zasso) (#36187) * events: * support signal in EventTarget (Benjamin Gruenbaum) (#36258) * graduate Event, EventTarget, AbortController (James M Snell) (#35949) * http: * enable call chaining with setHeader() (pooja d.p) (#35924) * module: * add isPreloading indicator (James M Snell) (#36263) * stream: * support abort signal (Benjamin Gruenbaum) (#36061) * add FileHandle support to Read/WriteStream (Momtchil Momtchev) (#35922) * worker: * add experimental BroadcastChannel (James M Snell) (#36271)
Make `response.setHeader` return the response object itself so that multiple header setting can be chained. Fixes: nodejs#33148 PR-URL: nodejs#35924 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ricky Zhou <[email protected]> Reviewed-By: Rich Trott <[email protected]>
PR-URL: #36435 Notable changes: * child_processes: * add AbortSignal support (Benjamin Gruenbaum) (#36308) * deps: * update ICU to 68.1 (Michaël Zasso) (#36187) * events: * support signal in EventTarget (Benjamin Gruenbaum) (#36258) * graduate Event, EventTarget, AbortController (James M Snell) (#35949) * http: * enable call chaining with setHeader() (pooja d.p) (#35924) * module: * add isPreloading indicator (James M Snell) (#36263) * stream: * support abort signal (Benjamin Gruenbaum) (#36061) * add FileHandle support to Read/WriteStream (Momtchil Momtchev) (#35922) * worker: * add experimental BroadcastChannel (James M Snell) (#36271)
PR-URL: #36435 Notable changes: * child_processes: * add AbortSignal support (Benjamin Gruenbaum) (#36308) * deps: * update ICU to 68.1 (Michaël Zasso) (#36187) * events: * support signal in EventTarget (Benjamin Gruenbaum) (#36258) * graduate Event, EventTarget, AbortController (James M Snell) (#35949) * http: * enable call chaining with setHeader() (pooja d.p) (#35924) * module: * add isPreloading indicator (James M Snell) (#36263) * stream: * support abort signal (Benjamin Gruenbaum) (#36061) * add FileHandle support to Read/WriteStream (Momtchil Momtchev) (#35922) * worker: * add experimental BroadcastChannel (James M Snell) (#36271)
Make `response.setHeader` return the response object itself so that multiple header setting can be chained. Fixes: #33148 PR-URL: #35924 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ricky Zhou <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Make
response.setHeaderreturn the response object itselfso that multiple header setting can be chained.
Fixes: #33148
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes