turns out Bytes implements FromRequest
This commit is contained in:
parent
a3dab56ddb
commit
8329c75ccf
2 changed files with 4 additions and 5 deletions
|
@ -28,7 +28,7 @@
|
|||
path = ./.;
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-6aA95Zm1FGp8xiv55QSBZFfmBXWz5pygc/8uQHvy3tM=";
|
||||
cargoSha256 = "sha256-YZHQCFojC8Ch9jcyxXLKEVsMNtI4ufzbCPUPLbUkMCI=";
|
||||
};
|
||||
in rec {
|
||||
packages = forAllSystems (s: let
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::fmt::Debug;
|
|||
use anyhow::Result;
|
||||
use axum::{
|
||||
async_trait,
|
||||
extract::{FromRef, FromRequestParts, Query, RawBody, State},
|
||||
extract::{FromRef, FromRequestParts, Query, State},
|
||||
http::{header::AUTHORIZATION, request::Parts, HeaderValue, StatusCode},
|
||||
response::{IntoResponse, Response},
|
||||
routing::{delete, get, post},
|
||||
|
@ -14,7 +14,7 @@ use bb8::Pool;
|
|||
use bb8_redis::RedisConnectionManager;
|
||||
use hex::FromHex;
|
||||
use hyper::{
|
||||
body::to_bytes,
|
||||
body::Bytes,
|
||||
header::{CONTENT_TYPE, ETAG, IF_NONE_MATCH},
|
||||
Method,
|
||||
};
|
||||
|
@ -358,10 +358,9 @@ async fn delete_data(
|
|||
async fn set_data(
|
||||
AuthenticatedUser(id): AuthenticatedUser,
|
||||
RedisConnection(mut conn): RedisConnection,
|
||||
RawBody(body): RawBody,
|
||||
body: Bytes,
|
||||
) -> Result<Json<serde_json::Value>, WrappedError> {
|
||||
let now = (OffsetDateTime::now_utc().unix_timestamp_nanos() / 1000) as u64;
|
||||
let body = to_bytes(body).await?;
|
||||
redis::cmd("HSET")
|
||||
.arg(id)
|
||||
.arg("last_modified")
|
||||
|
|
Loading…
Reference in a new issue