You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add extra to prepareHeaders, update documentation + tests (reduxjs#1922)
* Document missing properties on prepareHeaders signature
* Add a test for forced, type, endpoint in fetchBaseQuery
* Pass extra to prepareHeaders
* Convert example.com urls from http->https, use nodeFetch as fetchFn in test
Copy file name to clipboardexpand all lines: docs/rtk-query/api/fetchBaseQuery.mdx
+11-2
Original file line number
Diff line number
Diff line change
@@ -19,10 +19,19 @@ It takes all standard options from fetch's [`RequestInit`](https://developer.moz
19
19
- Typically a string like `https://api.your-really-great-app.com/v1/`. If you don't provide a `baseUrl`, it defaults to a relative path from where the request is being made. You should most likely _always_ specify this.
20
20
-`prepareHeaders`_(optional)_
21
21
22
-
- Allows you to inject headers on every request. You can specify headers at the endpoint level, but you'll typically want to set common headers like `authorization` here. As a convenience mechanism, the second argument allows you to use `getState` to access your redux store in the event you store information you'll need there such as an auth token.
22
+
- Allows you to inject headers on every request. You can specify headers at the endpoint level, but you'll typically want to set common headers like `authorization` here. As a convenience mechanism, the second argument allows you to use `getState` to access your redux store in the event you store information you'll need there such as an auth token. Additionally, it provides access to `extra`, `endpoint`, `type`, and `forced` to unlock more granular conditional behaviors.
0 commit comments