Skip to content

Modify https.globalAgent doesn't effect #9057

@vagruchi

Description

@vagruchi
  • Version: 6.5.0
  • Platform: Linux 3.10.0-327.13.1.el7.x86_64
  • Subsystem: https

I modify globalAlgent to use proxy.
Next code:

var https = require("https")
var url = require("url")

https.globalAgent = MyProxyAgent
let parsedURL = url.parse(urlString)
parsedURL.method = 'POST' 
let req = https.request(parsedURL, console.log)
req.on("error", console.log)
req.end()

this give me error:
Error: connect ECONNREFUSED
But if i paste this code parsedURL.agent = https.globalAgent before https.request all works fine.
Also i tried to modify http.globalAgent. It isn't work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues that are suitable for first-time contributors.httpIssues or PRs related to the http subsystem.httpsIssues or PRs related to the https subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions