We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I have two endpoints, but only one of them requires Authorization header on every request. How can I achieve this?
Authorization
For example:
const restLink = new RestLink({ endpoints: { v1: '...', v2: '...', }, uri: '...', headers: { Authorization: '...' } })
The above code will add Authorization on both v1 and v2 endpoints, but I only want v1 to have Authorization header.
v1
v2
Thanks!
The text was updated successfully, but these errors were encountered:
You might be able to build a context-link that reads the @rest(…) data to figure out what headers to patch.
@rest(…)
Alternatively, you can provide a customFetch implementation (wrap fetch & delete that header if hitting v2) -- I'm sure this would work today!
customFetch
fetch
Sorry, something went wrong.
@fbartho Thanks for your help. Tried both approaches and worked!
Link Context requires to check query name whereas customFetch gives me request URL and I can apply different headers based on that.
Link Context
Which way do you guys recommend?
Sounds like customFetch is easiest for you, I recommend that 😉.
If you think we need per-endpoints headers or other tooling, that could be a useful enhancement.
headers
No branches or pull requests
Hi, I have two endpoints, but only one of them requires
Authorization
header on every request. How can I achieve this?For example:
The above code will add
Authorization
on bothv1
andv2
endpoints, but I only wantv1
to haveAuthorization
header.Thanks!
The text was updated successfully, but these errors were encountered: