Allow to pass relative url as config
wodka opened this issue · 6 comments
Currently when passing something like '/unleash' into the config an error is thrown.
new UnleashClient({
url: '/unleash',
})
Throws:
TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:371:5)
at onParseError (node:internal/url:552:9)
at new URL (node:internal/url:628:5)
at new UnleashClient (node_modules/unleash-proxy-client/build/index.js:121:21)
https://github.com/Unleash/unleash-proxy-client-js/blob/main/src/index.ts#L123
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
still open!
Thanks for this suggestion, I'll bring it up with the team.
I think this makes sense to do in relation to a feature we are working on with embedding the proxy into unleash for easy setup.
The upcoming support for URL
instances in config objects can help when using paths, though a base
is still required:
new UnleashClient({
url: new URL('/unleash', document.baseURI),
})
We could perhaps do this automatically for relative URL strings, but not sure if necessary.
Should be included in the following versions:
unleash-proxy-client-js v2.1.0
@unleash/proxy-client-vue v0.0.4
@unleash/proxy-client-svelte v0.0.4
@unleash/proxy-client-react v3.3.0