Skip to content

url.parse is deprecated - Requests going to localhost #66

Open
@tbenyon

Description

@tbenyon

I found that url.parse being deprecated meant that the requests were going to localhost.

I had to modify that start of the postMessage() function to this:

var postMessage = function(message, callback) {
  var body = JSON.stringify(message);

  const urlObject = new url()

  let options = {
    hostname: urlObject.host,
    method: 'POST',
    path: urlObject.pathname,
    headers: {
      'Content-Type': 'application/json',
      'Content-Length': Buffer.byteLength(body),
    }
  };

  var postReq = https.request(options, function(res) {
  ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions