Skip to content

[http_client] setHost: true should not prevent a default "Host" header #19457

@aleclarson

Description

@aleclarson
  • Version: v9.8.0
  • Platform: N/A
  • Subsystem: N/A

var setHost = (options.setHost === undefined);

This should be options.setHost !== false so I can do the following:

https.request({
  setHost: opts.host !== false
}, cb)

Currently, I have to do the following:

let config = {}
if (opts.host === false) {
  config.setHost = false
}
https.request(config, cb)

In other words, setting setHost to true causes the "Host" header to not be set to a default value. This is confusing behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions