-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
Allow extend() to append to prefixUrl #586
Comments
I think something like this would be useful. It should probably be called |
+1 ! This functionality can be useful when an API has multiples levels. |
|
I propose a more generic feature to solve this. When using const api = ky.create({ prefixUrl: "https://www.example.com/api" });
const sales = api.extend((options => ({ prefixUrl: options.prefixUrl + "/sales/v1" }));
await sales.post("offers", { json: {} }); // POSTs to https://www.example.com/api/sales/v1/offers |
callback function receives parent's default options to allow extended instance to refer to modify parent options Closes sindresorhus#586
I'd like a way to use
extend()
and append to the existingprefixUrl
:Today if I use
prefixUrl
in anextend()
call then it overwrites the "base"prefixUrl
and I don't see any way to access the configuredprefixUrl
from the "base"KyInstance
. Is this already possible and I've overlooked it?The text was updated successfully, but these errors were encountered: