Skip to content

doc, test: add note to response.getHeaders - #12887

Closed
refack wants to merge 0 commit into
nodejs:masterfrom
refack:fix-12885-change-doc
Closed

doc, test: add note to response.getHeaders#12887
refack wants to merge 0 commit into
nodejs:masterfrom
refack:fix-12885-change-doc

Conversation

@refack

@refackrefack commented May 7, 2017

Copy link
Copy Markdown
Contributor
  • also correct language for the same note for querystring.parse
  • add assertions for said note

Fixes: #12885
Ref: #12883

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

test,doc

@refack
refack requested a review from mscdexMay 7, 2017 18:51
@refackrefack self-assigned this May 7, 2017
@refackrefack added doc Issues and PRs related to the documentations. http Issues or PRs related to the http subsystem. test Issues and PRs related to the tests. labels May 7, 2017
@refack

Copy link
Copy Markdown
ContributorAuthor

Comment threaddoc/api/querystring.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

typo: space after typical

Comment threaddoc/api/querystring.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you try to use complete sentences in the documentation? Also, this isn’t that simple anyway. Other Contexts can have different Object objects anyway – the better advice is to avoid instanceof for builtins in JS code (i.e. please drop the last sentence here).

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Reasonable 👍

Comment threaddoc/api/http.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you put this note at the end of the documentation section?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Only difference is that there there is no explicit * Returns: {Object}

Comment threaddoc/api/http.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What's going on with this hunk?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I don't know, reverting

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

There's a weird space at line 559 that made my editor decide it's a UTF-8 file, and added the BOM.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You mean UTF-16?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Comment threaddoc/api/http.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you put the note in the prose like querystring.parse()?

Comment threaddoc/api/http.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Missing space between "typical" and "Object"

Comment threaddoc/api/http.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Either make the last bit a complete sentence, or fold it into the previous sentence.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Removing.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

deepStrictEqual while at it?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Need to remove prototype from {}, but why not...

@refack
refackforce-pushed the fix-12885-change-doc branch from 178a714 to 1bc296eCompareMay 7, 2017 19:16
@refack

Copy link
Copy Markdown
ContributorAuthor

Addressed. PTAL.

@refack

Copy link
Copy Markdown
ContributorAuthor

Comment threaddoc/api/http.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

still a missing space after “typical”

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ack

Comment threaddoc/api/http.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still missing a space.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not just compare it to Object.create(null)?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Fails on 7.10 🤷‍♂️

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Changed.
(Well the test fails anyway in other places on 7.10)

@refack
refackforce-pushed the fix-12885-change-doc branch 2 times, most recently from 1677823 to f13cde2CompareMay 7, 2017 19:25

@addaleaxaddaleax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, but the old querystring.md wording sounded a bit clearer to me.

@refack

Copy link
Copy Markdown
ContributorAuthor

/cc @nodejs/documentation comments about the wording?

Comment threaddoc/api/http.md Outdated

@mscdexmscdexMay 7, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/extend the/inherit from the/

Comment threaddoc/api/http.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just to be sure, the extra whitespace at the end of this line has been removed, right?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

There's a Unicode white space there, that I converted to \u0020. I'll make sure that it's right

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

There was a \0x00A0 at position 5 I replaced with \u0020. I verified with a hex compare.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: This is an object, not object like :D

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I had this discussion with @addaleax. How can it be an Object if objLike instaceof Object === false ?
According to OOP definitions "not" objLike is an Object. It's actually a null with properies 😉

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I could call it sonOfNull...

@mscdexmscdexMay 8, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with @thefourtheye, it's still an object according to the spec.

@refack
refackforce-pushed the fix-12885-change-doc branch from f13cde2 to b303aefCompareMay 8, 2017 02:53
Comment threaddoc/api/http.md Outdated

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

replaced a \u00A0 with a \u0020, so now the document is ANSI and not UTF-8

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@refack Just to be clear, our docs are UTF-8 and don’t need to be restricted to ASCII. This change is obviously fine, but it might be a good idea to tell your editor to not use BOMs for UTF-8.

Comment threaddoc/api/querystring.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

s/extend the/inherit from the/

@refack
refackforce-pushed the fix-12885-change-doc branch from b303aef to f16669aCompareMay 8, 2017 03:11
// eslint-disable-next-line no-restricted-properties
assert.deepEqual(res.getHeaders(), {});
const headers = res.getHeaders();
const exoticObj = Object.create(null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: I am being extremely pedantic here. So please ignore this comment, if you don't agree. Quoting 9.1 Ordinary Object Internal Methods and Internal Slots,

All ordinary objects have an internal slot called [[Prototype]]. The value of this internal slot is either null or an object and is used for implementing inheritance.

This object doesn't do or posses anything exotic. So this is still a normal object I believe.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with @thefourtheye. Probably better to call it something like simpleObj or bareObj or something similar without getting too wordy...

@refackrefack closed this May 10, 2017
@refack
refackforce-pushed the fix-12885-change-doc branch from f16669a to e1cabf6CompareMay 10, 2017 15:08
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 <anna@addaleax.net>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
@refack

Copy link
Copy Markdown
ContributorAuthor

landed in e1cabf6

@refack
refack deleted the fix-12885-change-doc branch May 10, 2017 15:09
@refack

Copy link
Copy Markdown
ContributorAuthor

@mscdex

Copy link
Copy Markdown
Contributor

@refack I think you left that CI comment on the wrong PR? That CI run is for this commit: "test: use assert regexp in tls no cert test"

@refack

Copy link
Copy Markdown
ContributorAuthor

@refack I think you left that CI comment on the wrong PR? That CI run is for this commit: "test: use assert regexp in tls no cert test"

Since the CI is on master the one CI job covers three small lands I did almost together.

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 <anna@addaleax.net>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
@jasnelljasnell mentioned this pull request May 28, 2017
@refackrefack removed their assignment Jun 12, 2017
@gibfahngibfahn mentioned this pull request Jun 15, 2017
3 tasks
@gibfahn

Copy link
Copy Markdown
Member

Should this be backported to v6.x-staging? If yes please follow the guide and raise a backport PR, if no let me know or add the dont-land-on label.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docIssues and PRs related to the documentations.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.

doc: res.getHeaders return value wrong in docs

7 participants

@refack@mscdex@gibfahn@thefourtheye@addaleax@lpinca@TimothyGu