Open mrchantey opened 1 week ago
When I had first looked into it some years ago ureq didn't appear to have middleware support, but I see now that has since changed. Given that it may be possible but I would need to play around with it to know for sure.
If I get some free time soon I'll look into what it would take to create a ureq client library for http-cache.
@mrchantey i noticed in the linked issue that one problem with using reqwest was the requirement of tokio.
Because http-cache is an async library we will need to deal with this somehow to use with ureq. Since this library would really start off for your use case do you have any input on how this might best be handled? It's my understanding we would need to import some async runtime to do this, but maybe there's another way I'm just not aware of.
Edit: to clarify this would be a requirement for the ureq http cache client library, not your code itself. But I want to check for any opinions on the matter before I attempt to throw something together.
Good question the requests are made in a non-tokio async block, its my understanding that bevy has some custom async implementation.
The first implementation used surf
and http-cache-surf
wich did work, code here, but when we tried replacing it with reqwest
it seemed to require tokio async. The decision was made to use ureq
because its lightweight, heres a bit more context in the discord.
I think @aevyrie would be a good person to ask about deeper bevy async stuff if required.
I think I might be able to use futures::executor::block_on
for this. I will try to throw something together and see what happens.
Made an effort to start on this but running into some lifetime problems that I think are Send/Sync related on the ureq Middleware trait. Will look into this again as I have time but if any progress is made your way I'd also be happy to accept a PR.
Sounds good thanks for giving it a look.
I'm working on a feature that requires the use of
ureq
as well as http caching, any tips or prior art for usinghttp-cache
with ureq?