Skip to content

how to customize middleware #210

Answered by davidpdrsn
ali322 asked this question in Q&A
Discussion options

You must be logged in to vote

All axum responses must use axum::body::BoxBody as the response body. MyAuth is using hyper::Body which doesn't work.

Change type ResponseBody = Body; to type ResponseBody = axum::body::BoxBody; and create the response with .body(axum::body::box_body(Body::from("request reject because of xxx"))). Then it'll work.

Also, why didn't you say all this in your original question? There was no way for me to know you were talking about AuthorizeRequest.

Replies: 5 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ali322
Comment options

Answer selected by davidpdrsn
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 #209 on August 19, 2021 10:12.