Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sweethuman opened this issue Jul 13, 2023 · 0 comments

Comments

@sweethuman
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant