Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,11 @@ added: v1.6.0
-->

* `name` {string}
* Returns: {string}
* Returns: {string, string[]} - type as set via `setHeader()`

@Trott Trott Apr 9, 2018 •

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.

The type as set via part seems out of place. If the information is critical, it can be included in the text below.

Use a | to separate the two possible return types, not a comma. (This is to be consistent with our documentation elsewhere.)

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.

@vsemozhetbyt Yes, thanks, updated!


Reads out a header on the request. Note that the name is case insensitive.
The return value is that one set via `setHeader()` as coercing to string
happens during transmission.

@Trott Trott Apr 9, 2018 •

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.

This sentence is a bit difficult to understand. How about this instead:

The type of the return value depends on the arguments provided to `setHeader()`.

Also, setHeaders() should be a link to that function in the docs.

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.

@vsemozhetbyt Whoops, yes, thanks for the correction!


Example:
```js
Expand Down Expand Up @@ -1210,7 +1212,8 @@ added: v0.4.0

Sets a single header value for implicit headers. If this header already exists
in the to-be-sent headers, its value will be replaced. Use an array of strings
here to send multiple headers with the same name.
here to send multiple headers with the same name. Values are coerced to
strings if needed during transmission.

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.

Perhaps just this for the last sentence? Non-string values will be coerced to strings.


Example:

Expand Down