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

ureq 3 does not permit custom Response bodies in Middleware #839

Open
kade-robertson opened this issue Oct 2, 2024 · 1 comment
Open

Comments

@kade-robertson
Copy link
Contributor

kade-robertson commented Oct 2, 2024

At least, I can't seem to figure out a way to do this at the moment. For context, I have a project where I implement a caching middleware to allow me to store responses, as they are essentially permanently cache-able. I have some very rudimentary logic to do this with the current 2.x releases here: https://github.com/kade-robertson/ddragon/blob/master/src/cache_middleware.rs

I'm working on updating this to 3.x, but this is the last piece I can't replicate (in-progress branch here: https://github.com/kade-robertson/ddragon/tree/ureq-3.x).

Ideally, this would also mean the previous limitation I had (UTF-8 text only response caching, though I think this was previously solved with the http-interop feature I added and just.. never updated my other work with it) would also be resolved, so I could avoid the odd logic I have for caching things like images. If this was flexible enough, it could mean something like http-cache could get a ureq implementation.

Related: #589 (wasn't sure if it made sense to re-open this)

@kade-robertson kade-robertson changed the title ureq 3 does not permit custom bodies in Middleware ureq 3 does not permit custom Response bodies in Middleware Oct 2, 2024
@algesten
Copy link
Owner

algesten commented Oct 3, 2024

Excellent feedback, thanks!

I realise I made a big omission here not letting users construct the response bodies. I will fix this. Thank you so much for testing and reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants