Skip to content

Commit 73f762d

Browse files
committed
docs: make readme example consistent
1 parent 16e723f commit 73f762d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ use axum::{Router, response::IntoResponse};
3131
use axum_codec::{
3232
response::IntoCodecResponse,
3333
routing::{get, post},
34-
Codec,
35-
extract::Accept,
34+
Codec, Accept,
3635
};
3736

3837
// Shorthand for the following (assuming all features are enabled):
@@ -62,12 +61,12 @@ async fn me() -> Codec<User> {
6261
}
6362

6463
/// A manual implementation of the handler above.
65-
async fn manual_me(accept: Accept, Codec(user): Codec<User>) -> impl IntoResponse {
64+
async fn manual_me(accept: Accept) -> impl IntoResponse {
6665
Codec(User {
6766
name: "Alice".into(),
6867
age: 42,
6968
})
70-
.into_codec_response(accept.content_type())
69+
.into_codec_response(accept.into())
7170
}
7271

7372
#[axum_codec::apply(encode)]
@@ -86,7 +85,7 @@ async fn greet(Codec(user): Codec<User>) -> impl IntoCodecResponse {
8685
async fn main() {
8786
let app: Router = Router::new()
8887
.route("/me", get(me).into())
89-
.route("/manual", axum::routing::post(manual_me))
88+
.route("/manual", axum::routing::get(manual_me))
9089
.route("/greet", post(greet).into());
9190

9291
let listener = tokio::net::TcpListener::bind(("127.0.0.1", 3000))

0 commit comments

Comments
 (0)