We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Location
1 parent 8ee3217 commit 161fb73Copy full SHA for 161fb73
1 file changed
backend/api/routes/v1/users.rs
@@ -1,6 +1,6 @@
1
//! The set of all users.
2
3
-use axum::http::StatusCode;
+use axum::http::{header, StatusCode};
4
use axum_macros::debug_handler;
5
use serde::{Deserialize, Serialize};
6
use sqlx::Acquire;
@@ -97,8 +97,11 @@ pub(crate) async fn post(Json(body): Json<PostRequest>) -> impl Response<PostRes
97
})
98
.await?;
99
100
- // TODO: Set `Location` header.
101
- Ok((StatusCode::CREATED, Json(PostResponse { id: user_id })))
+ Ok((
+ StatusCode::CREATED,
102
+ [(header::LOCATION, format!("/api/v1/users/{user_id}"))],
103
+ Json(PostResponse { id: user_id }),
104
+ ))
105
}
106
107
/// A `POST` response body for this API route.
0 commit comments