flask-stupe
flask-stupe copied to clipboard
WIP: Implement pagination headers
Hi, I PR this as apparently there is a need (@trubesv ). At least we can discuss the implementation.
It lacks a test case, though.
Yep, it really does!
Also, check the Travis build, it's failing.
Pull Request Test Coverage Report for Build 130
- 36 of 36 (100.0%) changed or added relevant lines in 3 files are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage remained the same at 100.0%
| Totals | |
|---|---|
| Change from base Build 108: | 0.0% |
| Covered Lines: | 399 |
| Relevant Lines: | 399 |
💛 - Coveralls
Concerning the current implementation, i tried to stick to the RFC linked by @tobes. Don't you think it's the best thing to do ? https://tools.ietf.org/html/rfc5988#page-6
Don't we want the dict values in the body to only contain the links, without the >; rel='...' part?
PyMongo already handles that for the limit: it keeps the absolute value and consider 0 as "no limit". We might want to validate that skip is a positive integer though, or just handle the ValueError that PyMongo would raise.
I think we should simply not offer the relatives links if we're on an edge.