Skip to content

Building URL's with path instead of URL or something else causes issues on Windows machines #16

@sweethuman

Description

@sweethuman

In api.js you're building the url path using the path library. This is an issue because it was meant for file system paths.

The resulting path on a unix machine is:
https:/api.coconut.co/v2/jobs which kinda works since https.request is smart enough to not have issue with only one / at https.

BUT, on Windows the result is:
https:\\api.coconut.co\\v2\\jobs this doesn't work, https.request sees this invalid url and tries it's best to convert it and it ends up being https://api.coconut.co//v2/jobs. Now the server since it receives this invalid url it responds with 400 Bad Request.

A good fix would be to use something like the URL object to build the URL or somethign else.

Warning
path is only meant for filesystem paths.

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