Skip to content

Commit d852428

Browse files
committed
Update axum
1 parent 97e12fc commit d852428

8 files changed

Lines changed: 23 additions & 47 deletions

File tree

Cargo.lock

Lines changed: 11 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ anymap = "0.12"
155155
arrayvec = "0.7.2"
156156
async-stream = "0.3.6"
157157
async-trait = "0.1.68"
158-
axum = { version = "0.7", features = ["tracing"] }
159-
axum-extra = { version = "0.9", features = ["typed-header"] }
158+
axum = { version = "0.8.4", features = ["tracing"] }
159+
axum-extra = { version = "0.10", features = ["typed-header"] }
160160
backtrace = "0.3.66"
161161
base64 = "0.21.2"
162162
bigdecimal = "0.4.7"

crates/client-api/src/auth.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,6 @@ pub struct SpacetimeAuthHeader {
385385
auth: Option<SpacetimeAuth>,
386386
}
387387

388-
#[async_trait::async_trait]
389388
impl<S: NodeDelegate + Send + Sync> axum::extract::FromRequestParts<S> for SpacetimeAuthHeader {
390389
type Rejection = AuthorizationRejection;
391390
async fn from_request_parts(parts: &mut request::Parts, state: &S) -> Result<Self, Self::Rejection> {
@@ -461,7 +460,6 @@ impl SpacetimeAuthHeader {
461460

462461
pub struct SpacetimeAuthRequired(pub SpacetimeAuth);
463462

464-
#[async_trait::async_trait]
465463
impl<S: NodeDelegate + Send + Sync> axum::extract::FromRequestParts<S> for SpacetimeAuthRequired {
466464
type Rejection = AuthorizationRejection;
467465
async fn from_request_parts(parts: &mut request::Parts, state: &S) -> Result<Self, Self::Rejection> {

crates/client-api/src/routes/database.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ pub async fn reset<S: NodeDelegate + ControlStateDelegate + Authorization>(
616616
host_type,
617617
}): Query<ResetDatabaseQueryParams>,
618618
Extension(auth): Extension<SpacetimeAuth>,
619-
program_bytes: Option<Bytes>,
619+
program_bytes: Bytes,
620620
) -> axum::response::Result<axum::Json<PublishResult>> {
621621
let database_identity = name_or_identity.resolve(&ctx).await?;
622622
let database = worker_ctx_find_database(&ctx, &database_identity)
@@ -631,7 +631,7 @@ pub async fn reset<S: NodeDelegate + ControlStateDelegate + Authorization>(
631631
&auth.claims.identity,
632632
DatabaseResetDef {
633633
database_identity,
634-
program_bytes,
634+
program_bytes: Some(program_bytes),
635635
num_replicas,
636636
host_type: Some(host_type),
637637
},
@@ -716,7 +716,7 @@ pub async fn publish<S: NodeDelegate + ControlStateDelegate + Authorization>(
716716
host_type,
717717
}),
718718
Extension(auth),
719-
Some(program_bytes),
719+
program_bytes,
720720
)
721721
.await;
722722
}
@@ -1244,7 +1244,7 @@ where
12441244
.route("/names", self.names_put)
12451245
.route("/identity", self.identity_get)
12461246
.route("/subscribe", self.subscribe_get)
1247-
.route("/call/:reducer", self.call_reducer_procedure_post)
1247+
.route("/call/{reducer}", self.call_reducer_procedure_post)
12481248
.route("/schema", self.schema_get)
12491249
.route("/logs", self.logs_get)
12501250
.route("/sql", self.sql_post)
@@ -1254,7 +1254,7 @@ where
12541254

12551255
axum::Router::new()
12561256
.route("/", self.root_post)
1257-
.nest("/:name_or_identity", db_router)
1257+
.nest("/{name_or_identity}", db_router)
12581258
.route_layer(axum::middleware::from_fn_with_state(ctx, anon_auth_middleware::<S>))
12591259
}
12601260
}

crates/client-api/src/routes/energy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ where
131131
{
132132
use axum::routing::get;
133133
axum::Router::new().route(
134-
"/:identity",
134+
"/{identity}",
135135
get(get_energy_balance::<S>)
136136
.put(set_energy_balance::<S>)
137137
.post(add_energy::<S>),

crates/client-api/src/routes/identity.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ where
175175
.route("/", self.create_post)
176176
.route("/public-key", self.public_key_get)
177177
.route("/websocket-token", self.websocket_token_post)
178-
.route("/:identity/verify", self.verify_get)
179-
.route("/:identity/databases", self.databases_get)
178+
.route("/{identity}/verify", self.verify_get)
179+
.route("/{identity}/databases", self.databases_get)
180180
}
181181
}

crates/client-api/src/util.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use crate::{log_and_500, ControlStateReadAccess};
2121

2222
pub struct ByteStringBody(pub ByteString);
2323

24-
#[async_trait::async_trait]
2524
impl<S: Send + Sync> FromRequest<S> for ByteStringBody {
2625
type Rejection = axum::response::Response;
2726

@@ -165,8 +164,7 @@ impl fmt::Display for NameOrIdentity {
165164

166165
pub struct EmptyBody;
167166

168-
#[async_trait::async_trait]
169-
impl<S> FromRequest<S> for EmptyBody {
167+
impl<S: Sync> FromRequest<S> for EmptyBody {
170168
type Rejection = axum::response::Response;
171169
async fn from_request(req: Request, _state: &S) -> Result<Self, Self::Rejection> {
172170
let body = req.into_body();

crates/client-api/src/util/websocket.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ pub enum WebSocketUpgradeRejection {
7878
KeyMissing,
7979
}
8080

81-
#[async_trait::async_trait]
82-
impl<S> FromRequestParts<S> for WebSocketUpgrade {
81+
impl<S: Sync> FromRequestParts<S> for WebSocketUpgrade {
8382
type Rejection = WebSocketUpgradeRejection;
8483
async fn from_request_parts(parts: &mut http::request::Parts, _state: &S) -> Result<Self, Self::Rejection> {
8584
use WebSocketUpgradeRejection::*;

0 commit comments

Comments
 (0)