Uh oh!
There was an error while loading. Please reload this page.
http: enable setHeader for call chaining - #35924
Conversation
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? |
There was a problem hiding this comment.
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
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 |
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)
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.setHeaderreturn the response object itselfso that multiple header setting can be chained.
Fixes: #33148
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes