tower-rs / tower-http

HTTP specific Tower utilities.
676 stars 157 forks source link

Using MapRequestBodyLayer asynchronously #304

Open Zizico2 opened 1 year ago

Zizico2 commented 1 year ago

Feature Request

Motivation

Is there any chance we can use MapRequestBodyLayer with async functions?

Proposal

Maybe creating AsyncMapRequestBodyLayer-

Alternatives

davidpdrsn commented 1 year ago

That requires a separate middleware. I'd accept a pr for that

Zizico2 commented 1 year ago

Okok. I'm repurposing AsyncAuthorizeRequest for now. Just always returning Ok(req). I'd assume that would be good prior art for the PR.

Zizico2 commented 1 year ago

I'll try and shoot one your way

mateiidavid commented 1 year ago

@davidpdrsn @Zizico2 is this still something that can be picked up? Looking to learn a bit more about Tower and to contribute something.

Zizico2 commented 1 year ago

@mateiidavid It's a yes from me. I still haven't done any work on this. I'm using the solution I described above. If you come across any roadblock or tough design choice I'd be eager to discuss!

davidpdrsn commented 1 year ago

@mateiidavid yes!

mateiidavid commented 1 year ago

Awesome! Thanks to both of you for the replies. I'll try to get something working, probably in a few days once I have more free time. I won't be shy to reach out either here or on Discord if I get stuck :)