Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Commit 96be513

Browse files
committed
feat: update
1 parent 61bb8ca commit 96be513

5 files changed

Lines changed: 35 additions & 23 deletions

File tree

frameworks/Rust/hyperlane/Cargo.lock

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

frameworks/Rust/hyperlane/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ exclude = [
1818
]
1919

2020
[dependencies]
21-
hyperlane = "5.22.1"
22-
hyperlane-utils = "0.16.1"
21+
hyperlane = "5.25.1"
22+
hyperlane-utils = "0.17.0"
2323
rand = "0.9.1"
2424
serde = "1.0.219"
2525
sqlx = { version = "0.8.6", features = ["runtime-tokio", "postgres"] }

frameworks/Rust/hyperlane/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ pub(crate) mod server;
99
pub(crate) mod r#type;
1010
pub(crate) mod utils;
1111

12-
pub(crate) use db::*;
1312
pub(crate) use r#const::*;
13+
pub(crate) use db::*;
1414
pub(crate) use r#type::*;
1515
pub(crate) use utils::*;
1616

@@ -29,11 +29,11 @@ pub(crate) use hyperlane_utils::{
2929
futures::{executor::block_on, future::join_all},
3030
once_cell::sync::Lazy,
3131
serde::*,
32-
serde_json::{json, Value},
32+
serde_json::{Value, json},
3333
*,
3434
};
3535
pub(crate) use lazy::*;
36-
pub(crate) use rand::{rng, rngs::SmallRng, Rng, SeedableRng};
36+
pub(crate) use rand::{Rng, SeedableRng, rng, rngs::SmallRng};
3737
pub(crate) use server::*;
3838
pub(crate) use sqlx::{
3939
postgres::{PgPoolOptions, PgRow},

frameworks/Rust/hyperlane/src/request_middleware.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
use super::*;
22

33
pub async fn request(ctx: Context) {
4-
ctx.set_response_header(CONNECTION, CONNECTION_KEEP_ALIVE)
4+
ctx.set_response_header(CONNECTION, KEEP_ALIVE)
55
.await
66
.set_response_header(SERVER, HYPERLANE)
77
.await
88
.set_response_header(DATE, gmt())
9+
.await
10+
.set_response_status_code(200)
911
.await;
1012
#[cfg(feature = "plaintext")]
1113
{

frameworks/Rust/hyperlane/src/route.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@ pub async fn json(ctx: Context) {
55
"message": RESPONSEDATA_STR
66
});
77
let _ = ctx
8-
.send_response(200, serde_json::to_string(&json).unwrap_or_default())
8+
.set_response_body(serde_json::to_string(&json).unwrap_or_default())
9+
.await
10+
.send()
911
.await;
1012
}
1113

1214
pub async fn plaintext(ctx: Context) {
13-
let _ = ctx.send_response(200, RESPONSEDATA_BIN).await;
15+
let _ = ctx.set_response_body(RESPONSEDATA_BIN).await.send().await;
1416
}
1517

1618
pub async fn db(ctx: Context) {
1719
let db_connection: &DbPoolConnection = get_db_connection();
1820
let query_row: QueryRow = random_world_row(db_connection).await;
1921
let _ = ctx
20-
.send_response(200, serde_json::to_string(&query_row).unwrap_or_default())
22+
.set_response_body(serde_json::to_string(&query_row).unwrap_or_default())
23+
.await
24+
.send()
2125
.await;
2226
}
2327

@@ -32,7 +36,9 @@ pub async fn query(ctx: Context) {
3236
let db_pool: &DbPoolConnection = get_db_connection();
3337
let data: Vec<QueryRow> = get_some_row_id(queries, db_pool).await;
3438
let _ = ctx
35-
.send_response(200, serde_json::to_string(&data).unwrap_or_default())
39+
.set_response_body(serde_json::to_string(&data).unwrap_or_default())
40+
.await
41+
.send()
3642
.await;
3743
}
3844

@@ -52,7 +58,7 @@ pub async fn fortunes(ctx: Context) {
5258
));
5359
fortunes_list.sort_by(|it, next| it.message.cmp(&next.message));
5460
let res: String = FortunesTemplate::new(fortunes_list).to_string();
55-
let _ = ctx.send_response(200, res).await;
61+
let _ = ctx.set_response_body(res).await.send().await;
5662
}
5763

5864
pub async fn update(ctx: Context) {
@@ -65,7 +71,9 @@ pub async fn update(ctx: Context) {
6571
.max(1);
6672
let res: Vec<QueryRow> = update_world_rows(queries).await;
6773
let _ = ctx
68-
.send_response(200, serde_json::to_string(&res).unwrap_or_default())
74+
.set_response_body(serde_json::to_string(&res).unwrap_or_default())
75+
.await
76+
.send()
6977
.await;
7078
}
7179

@@ -79,6 +87,8 @@ pub async fn cached_query(ctx: Context) {
7987
.max(1);
8088
let res: Vec<QueryRow> = CACHE.iter().take(count as usize).cloned().collect();
8189
let _ = ctx
82-
.send_response(200, serde_json::to_string(&res).unwrap_or_default())
90+
.set_response_body(serde_json::to_string(&res).unwrap_or_default())
91+
.await
92+
.send()
8393
.await;
8494
}

0 commit comments

Comments
 (0)