-
Notifications
You must be signed in to change notification settings - Fork 122
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 overriding credentials via rest directive #214
Comments
I would write a Alternatively, you can use a custom context link to mess with the headers before they get sent. |
@fbartho Would you be willing to accept a PR for this as a feature/enhancement? |
@stramel I keep starting a response to your request, and losing track of the browser tab before submitting. I wanted to think about it carefully before responding with a reflex gut reaction. Right now, I feel like the I really don't think that we should do this as a new optional // Somewhere:
const credentialsRegistryByPathPrefix = {
"https://example.com/must-omit": { omit: true }
}
// Where you configure RestLink:
function myFetch(path, options) {
for(const p in credentialsRegistryByPathPrefix) {
if (path.startsWith(p)) {
options.credentials = { ...credentialsRegistryByPathPrefix[p], ...(options.credentials || {} ) };
}
}
return fetch(path, options);
}
const restLink = new RestLink({ customFetch: myFetch }); Obviously this is pseudo-code that I just wrote in my browser, but I think it would work. |
It would be great to be able to specify an override for
credentials
via the@rest
directive. The majority of my requests needsame-origin
but I have a handful that needomit
specified. Currently, I can't figure out a way to handle this use-case.The text was updated successfully, but these errors were encountered: