Skip to content
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

simpleRestProvider: using a custom http header to count items in a collection #5224

Merged
merged 3 commits into from
Sep 7, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update packages/ra-data-simple-rest/README.md
Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
  • Loading branch information
alexisjanvier and djhi authored Sep 7, 2020
commit b04a74f7d0a1226c196ed068f6999f51c18f8576
2 changes: 1 addition & 1 deletion packages/ra-data-simple-rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Now all the requests to the REST API will contain the `Authorization: SRTRDFVESG

Historically, Simple REST Data Provider uses the http `Content-Range` header to retrieve the number of items in a collection. But this is a *hack* of the [primary role of this header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range).

And this can be problematic, for example within an infrastructure using a Varnish that may use, modify or delete this header. We also have feedback indicating that using this header is problematic when you host your application on [Versel](https://vercel.com/).
However this can be problematic, for example within an infrastructure using a Varnish that may use, modify or delete this header. We also have feedback indicating that using this header is problematic when you host your application on [Vercel](https://vercel.com/).

The solution is to use another http header to return the number of collection's items, the other header commonly used for this is `X-Total-Count`. So if you use `X-Total-Count`, you will have to :
alexisjanvier marked this conversation as resolved.
Show resolved Hide resolved

Expand Down