Comments (6)
Yes, the request would need to be cloned so if you're dealing with a situation where that's not possible I would recommend removing the middleware for now.
from http-cache.
Thought about this a bit more and I could possibly add a new method that would be called in the middleware implementation before the run method call to determine if the request is cacheable or not, then maybe just continue the chain normally rather than calling the run method. This would at least allow those requests determined non cachable to proceed without needing to be cloned.
from http-cache.
@joolean not sure if you'd be interested in the details but I made a branch to test this change. Still looking things over and testing but I think it should work for your purposes in its current state. If it's determined to be a cacheable request then the logic would still run and error if a clone isn't possible, but now if it's determined to not be a cacheable request it the client implementation should run without cloning the request.
from http-cache.
Just FYI I finished up these changes and merged this into develop, so it'll be in the next release. This still can't work with requests that can't be cloned and determined to be cacheable but now it should at least work in those situations where it's determined to not be cacheable. Hope this update helps out!
from http-cache.
Thanks for working on this @06chaynes! This sounds like it'll address my use case quite well. I've been busy with work but will try out the new release as soon as it's ready.
from http-cache.
Sounds good! Just published the new versions so should be good to test whenever. Feel free to let me know if you have any issues!
from http-cache.
Related Issues (18)
- `url` interaction with redirects HOT 3
- Information about cache hits HOT 12
- Changelog HOT 2
- `Cache-Control: no-cache` header on request not respected? HOT 3
- `CacheManger` not implemented for `MokaManager` HOT 2
- `CACacheManager.path` should be a `PathBuf`, not a `String` HOT 2
- Configurable Cache Options and Cache Keys on a per Request Basis HOT 8
- Option to force cache regardless of Cache-Control headers? HOT 13
- Split out client middleware implementations to separate libraries HOT 1
- Enhancement: Store Deserialized HttpResponse for Improved Performance HOT 11
- Add hyper client middleware implementation HOT 10
- Clear-Site-Data header HOT 11
- Cache without storing the response HOT 7
- add WASM support HOT 8
- Error: Middleware(Middleware error: Request object is not cloneable. Are you passing a streaming body? HOT 1
- SQLite manager? HOT 3
- How to manually handle cache expiration? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http-cache.