Closed maxall41 closed 3 years ago
The issue is probably that your URL is not correctly formatted! Be sure to append an “https:” or “http:” scheme to the start of the address.
i changed 'example.com' to 'http://example.com' but i'm still getting the same error
Hmm, ok. Which Node version are you using?
i'm using v12.16.2
I have the same issue. My URL is formatted correctly too.
NPM version 6.14.5
Running into the same issues here. I am using phin 3.5.0
, node 14.5.0
and npm 6.14.5
in a React project (react 16.13.1
).
I just realized that phin
is not meant for frontend usage, which explains the URL error.
@maxall41 it looks like you're trying to use this with Vue. It is a Node package that uses native Node modules. You could try using Browserify but you may run into this issue https://github.com/ethanent/centra/issues/6
I'm trying to make a simple post request but i'm getting the error
TypeError: URL is not a constructor at new CentraRequest (CentraRequest.js?0a95:14) at module.exports (createRequest.js?ca09:4) at phin (phin.min.js?e014:1) at _callee$ (VM1328 index.vue:333) at tryCatch (runtime.js?96cf:45) at Generator.invoke [as _invoke] (runtime.js?96cf:274) at Generator.prototype.<computed> [as next] (runtime.js?96cf:97) at asyncGeneratorStep (asyncToGenerator.js?1da1:3) at _next (asyncToGenerator.js?1da1:25) at eval (asyncToGenerator.js?1da1:32)
Here's my code:await p({ url: "example.com", method: "POST", data: { test: 'hello' } });
Does anybody know how to fix this?