Skip to content

Commit

Permalink
Manually deserialize json
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Aug 2, 2024
1 parent 907abe3 commit 05b2914
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ prometheus-client = "0.22.2"
rand = "0.8.5"
reqwest = "0.12.4"
serde = { version = "1.0.114", features = ["derive"] }
serde_json = "1.0.122"
sled = "0.34.2"
structopt = "0.3.15"
tokio = { version = "1.39.2", features = ["full"] }
Expand Down
3 changes: 2 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ impl IntoResponse for AppError {
/// Registers a device for heartbeat notifications.
async fn register_device(
axum::extract::State(state): axum::extract::State<State>,
axum::extract::Json(query): axum::extract::Json<DeviceQuery>,
body: String,
) -> Result<(), AppError> {
let query: DeviceQuery = serde_json::from_str(&body)?;
info!("register_device {}", query.token);

let schedule = state.schedule();
Expand Down

0 comments on commit 05b2914

Please sign in to comment.