Skip to content

doc: nodejs > http > get > Example KO #37907

Closed
@youpiwaza

Description

📗 API Reference Docs Problem

  • Version: 14.16.0
  • Platform: Windows 64-bit, but not relevant
  • Subsystem: http

Location

Section of the site where the content exists

Affected URL(s):

Description

Concise explanation of the problem

Provided example doesn't work anymore, returns an error "Request failed. Status code: 301."

Sans titre

The provided url leads to http : http.get('http://nodejs.org/dist/index.json', (res) => {

but said resource get automatically redirected to it's https twin.

In the example, anything other than 200 is thrown away if (statusCode !== 200)

You need to set a new resource in http only (no redirection towards https) as the http module can't handle the https protocol ^^.

Cheers


  • I would like to work on this issue and
    submit a pull request.

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.httpIssues or PRs related to the http subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions