Skip to content

Conversation

@Trott
Copy link
Member

@TrottTrott commented May 7, 2017

test-http-mutable-headers uses assert.deepEqual() in three places but
appears to only needs it in two of them. Replace one with
assert.deepStrictEqual() and remove linting exception.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

test http

@TrottTrott added http Issues or PRs related to the http subsystem. test Issues and PRs related to the tests. labels May 7, 2017
@Trott
Copy link
MemberAuthor

Trott commented May 7, 2017

Copy link
Contributor

@refackrefackMay 7, 2017

Choose a reason for hiding this comment

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

I want to suggest

constheadersCopy=res.getHeaders();// eslint-disable-next-line no-restricted-propertiesconstexpected={'x-test-header': 'testing','x-test-header2': 'testing','set-cookie': cookies,'x-test-array-header': arrayValues};Object.setPrototypeOf(expected,null)assert.deepStrictEqual(headersCopy,expected);

And a question, why is headersCopy.__proto__ === undifined?
Also headersCopy.hasOwnPropert === undifined so the API is wrong it says the return value is an Object
https://nodejs.org/api/http.html#http_response_getheaders

Copy link
Member

Choose a reason for hiding this comment

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

And a question, why is headersCopy.__proto__ === undifined?

Because, as you noted, headersCopy has a null prototype, and therefore the __proto__ getter inherited from Object.prototype is missing.

Also headersCopy.hasOwnPropert === undifined so the API is wrong it says the return value is an Object
https://nodejs.org/api/http.html#http_response_getheaders

It’s still an object, it just doesn’t inherit from Object.prototype; if you have suggestions on how to improve the docs for this, sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

In my books it's not an Object if headersCopy instanceof Object === false 🤷‍♂️
Ref: #12885

Copy link
Member

@addaleaxaddaleax left a comment

Choose a reason for hiding this comment

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

LGTM (but if you want, feel free to go with @refack’s suggestion for changing the test code)

@refackrefack dismissed a stale review May 7, 2017 18:31

No, sorry I'm make a new PR

refack added a commit to refack/node that referenced this pull request May 10, 2017
* also correct language for the same note for querystring.parse * add assertions for said note PR-URL: nodejs#12887Fixes: nodejs#12885 Refs: nodejs#12883 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
test-http-mutable-headers uses assert.deepEqual() in three places but appears to only needs it in two of them. Replace one with assert.deepStrictEqual() and remove linting exception.
@Trott
Copy link
MemberAuthor

Went with @refack's suggestion. New CI: https://ci.nodejs.org/job/node-test-pull-request/7999/

Trott added a commit to Trott/io.js that referenced this pull request May 11, 2017
test-http-mutable-headers uses assert.deepEqual() in three places but appears to only needs it in two of them. Replace one with assert.deepStrictEqual() and remove linting exception. PR-URL: nodejs#12883 Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
@Trott
Copy link
MemberAuthor

Landed in 631cb42.

@TrottTrott closed this May 11, 2017
anchnk pushed a commit to anchnk/node that referenced this pull request May 19, 2017
* also correct language for the same note for querystring.parse * add assertions for said note PR-URL: nodejs#12887Fixes: nodejs#12885 Refs: nodejs#12883 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
anchnk pushed a commit to anchnk/node that referenced this pull request May 19, 2017
test-http-mutable-headers uses assert.deepEqual() in three places but appears to only needs it in two of them. Replace one with assert.deepStrictEqual() and remove linting exception. PR-URL: nodejs#12883 Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
@jasnelljasnell mentioned this pull request May 28, 2017
@gibfahngibfahn mentioned this pull request Jun 15, 2017
3 tasks
@MylesBorins
Copy link
Contributor

This does not land cleanly in LTS. Please feel free to manually backport. Please also feel free to replace the backport request label with do-not-land if it shouldn't land

@Trott
Copy link
MemberAuthor

@MylesBorins If #10805 gets backported, I can backport this after that lands.

@TrottTrott deleted the strict-yo branch July 31, 2018 15:35
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

httpIssues or PRs related to the http subsystem.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@Trott@MylesBorins@refack@jasnell@thefourtheye@addaleax@Fishrock123@lpinca@cjihrig