Skip to content
Discussion options

You must be logged in to vote

Through practice,can not get Bytes as layer(TowerMapRequestLayer::new(|req: Request| Arc::new(req))) is synchronous!

Thats intentional. You can write you own middleware if you need it to be async. Arc<Stream> doesn't help you anyway because actually consuming the body requires Pin<&mut self> which you cannot get through an Arc.

Also axum::body::Body not supports Clone

Yeah I just said as much. It's an async stream.

Now the way is to use axum(version 0.6.20) or the retry function is transferred to the client

You need to implement retries inside your app and not in a middleware. I'd recommend that anyway. Have a look at https://docs.rs/tryhard/latest/tryhard/index.html

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@artshell
Comment options

@davidpdrsn
Comment options

@artshell
Comment options

@davidpdrsn
Comment options

Answer selected by artshell
@artshell
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2390 on December 01, 2023 15:06.