Stop sending the redundant per_page parameter on every list request
This commit is contained in:
@@ -16,10 +16,18 @@ api.interceptors.request.use(config => {
|
|||||||
if (token) {
|
if (token) {
|
||||||
config.headers.Authorization = `Bearer ${token}`
|
config.headers.Authorization = `Bearer ${token}`
|
||||||
}
|
}
|
||||||
// Send both perpage and per_page for backend compatibility
|
// `per_page` used to be sent alongside `perpage` for backend compatibility.
|
||||||
if (config.params?.perpage) {
|
// get_pagination_params reads `perpage` and only falls back to `per_page`, and
|
||||||
config.params.per_page = config.params.perpage
|
// this client always sends `perpage`, so the duplicate never did anything -
|
||||||
}
|
// it just made every list URL carry a redundant parameter.
|
||||||
|
//
|
||||||
|
// Dropping it also has a one-off benefit worth recording. The endpoints list
|
||||||
|
// route used to redirect (308, PERMANENT and therefore cached by the browser
|
||||||
|
// against the exact URL including its query string). Clients that hit the old
|
||||||
|
// route hold that rewrite even after the server is fixed: the request never
|
||||||
|
// leaves the machine, so nothing deployed can clear it. Changing the query
|
||||||
|
// string changes the cache key, so those clients miss the poisoned entry and
|
||||||
|
// reach the corrected route.
|
||||||
return config
|
return config
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user