Http response headers
🚀 Feature Requests
Currently the CacheManager only returns the body of the http response. It will be really useful to be able to retrieve also the respnse headers.
Contextualize the feature
Some api for example insert the total number of pages (for pagination) in the response header, and currently is impossible to read it.
Describe the feature
The response file could be a json that contains both the headers and the body of the http response.
Platforms affected (mark all that apply)
- [x] :iphone: iOS
- [x] :robot: Android
Would you only expect that information when the information is coming right from the source, or also when it is retrieved from the local cache?
I think it could be useful to cache all the http response (headers, body, status...). I needed this because some api's (like wordpress rest api) insert important pagination info in the headers instead of the body. So when you request a file (either cached or not) the function could return the http.Response objet instead of a File object. This library (https://pub.dev/packages/dio_http_cache), for example, simply allow you to use the "get" request as normal, and handle all the caching in background. The downside is that you are obliged to use the Dio library instead of the "standard" http package. But it's concept of returning the response object is cool, and allows the user to retrieve every information he needs.
That's nice indeed, but I'm not sure if it should be in the scope of this library. Maybe it is better to make a generic http_cache manager that does that.
Ok, because this library is intended more for files instead of api's right?
Yep
Ok, well, at the moment I don't have the abilities to create that package so I hope that I gave you the idea for your next package 😁 There is no package that do this except for the one that I linked before. Thanks anyway!