Skip to content

Commit ce19918

Browse files
committed
feat: v4.5.1
1 parent 62d6b21 commit ce19918

File tree

17 files changed

+208
-191
lines changed

17 files changed

+208
-191
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hyperlane-macros"
3-
version = "4.5.0"
3+
version = "4.5.1"
44
readme = "README.md"
55
edition = "2024"
66
authors = ["[email protected]"]
@@ -30,7 +30,7 @@ proc-macro2 = "1.0.101"
3030
inventory = "0.3.21"
3131

3232
[dev-dependencies]
33-
hyperlane = "7.13.0"
33+
hyperlane = "7.14.2"
3434
serde = { version = "1.0.219", features = ["derive"] }
3535

3636
[profile.dev]

README.md

Lines changed: 75 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ use hyperlane::*;
204204
use hyperlane_macros::*;
205205
use serde::{Deserialize, Serialize};
206206

207+
const STEP: &str = "step";
207208
const TEST_ATTRIBUTE_KEY: &str = "test_attribute_key";
208209
const CUSTOM_STATUS_CODE: i32 = 200;
209210
const CUSTOM_REASON: &str = "Accepted";
@@ -217,29 +218,11 @@ struct TestData {
217218
age: u32,
218219
}
219220

220-
#[response_body("1")]
221-
#[request_middleware]
222-
#[response_version(HttpVersion::HTTP1_1)]
223-
async fn request_middleware(ctx: Context) {}
224-
225-
#[response_body("2")]
226-
#[request_middleware(1)]
227-
#[response_version(HttpVersion::HTTP1_1)]
228-
async fn request_middleware_1(ctx: Context) {}
229-
230-
#[response_middleware]
231-
async fn response_middleware(ctx: Context) {
232-
if ctx.get_request().await.get_upgrade_type().is_ws() {
233-
return;
234-
}
235-
}
236-
237221
#[send]
238-
#[response_middleware(1)]
239-
async fn response_middleware_1(ctx: Context) {}
240-
241222
#[panic_hook]
242-
#[send]
223+
#[panic_hook(1)]
224+
#[panic_hook("2")]
225+
#[response_body("panic_hook")]
243226
async fn panic_hook(ctx: Context) {}
244227

245228
#[route("/disable_http_hook")]
@@ -252,13 +235,56 @@ async fn disable_http_hook(ctx: Context) {}
252235
#[disable_ws_hook("/disable_ws_hook")]
253236
async fn disable_ws_hook(ctx: Context) {}
254237

238+
#[connected_hook]
239+
#[connected_hook(1)]
240+
#[connected_hook("2")]
241+
#[response_header(STEP => "connected_hook")]
242+
async fn connected_hook(ctx: Context) {}
243+
244+
#[pre_upgrade_hook]
245+
#[pre_upgrade_hook(1)]
246+
#[pre_upgrade_hook("2")]
247+
#[response_header(STEP => "pre_upgrade_hook")]
248+
async fn pre_upgrade_hook(ctx: Context) {}
249+
250+
#[request_middleware]
251+
#[response_header(SERVER => HYPERLANE)]
252+
#[response_version(HttpVersion::HTTP1_1)]
253+
#[response_header(STEP => "request_middleware_1")]
254+
async fn request_middleware_1(ctx: Context) {}
255+
256+
#[request_middleware(2)]
257+
#[response_header(STEP => "request_middleware_2")]
258+
async fn request_middleware_2(ctx: Context) {}
259+
260+
#[request_middleware("3")]
261+
#[response_header(STEP => "request_middleware_3")]
262+
async fn request_middleware_3(ctx: Context) {}
263+
264+
#[response_middleware]
265+
#[response_header(STEP => "response_middleware_1")]
266+
async fn response_middleware_1(ctx: Context) {}
267+
268+
#[response_middleware(2)]
269+
#[response_header(STEP => "response_middleware_2")]
270+
async fn response_middleware_2(ctx: Context) {}
271+
272+
#[send]
273+
#[response_middleware("3")]
274+
#[response_header(STEP => "response_middleware_3")]
275+
async fn response_middleware_3(ctx: Context) {
276+
if ctx.get_request().await.get_upgrade_type().is_ws() {
277+
return;
278+
}
279+
}
280+
255281
#[get]
256282
#[http]
257-
async fn ctx_pre_hook(ctx: Context) {}
283+
async fn pre_hook(ctx: Context) {}
258284

259285
#[flush]
260286
#[response_status_code(200)]
261-
async fn ctx_post_hook(ctx: Context) {}
287+
async fn post_hook(ctx: Context) {}
262288

263289
#[route("/response")]
264290
#[response_body(RESPONSE_DATA)]
@@ -267,79 +293,79 @@ async fn ctx_post_hook(ctx: Context) {}
267293
#[response_header(CUSTOM_HEADER_NAME => CUSTOM_HEADER_VALUE)]
268294
async fn response(ctx: Context) {}
269295

270-
#[connect]
271296
#[route("/connect")]
272297
#[response_body("connect")]
298+
#[connect]
273299
async fn connect(ctx: Context) {}
274300

275-
#[delete]
276301
#[route("/delete")]
277302
#[response_body("delete")]
303+
#[delete]
278304
async fn delete(ctx: Context) {}
279305

280-
#[head]
281306
#[route("/head")]
282307
#[response_body("head")]
308+
#[head]
283309
async fn head(ctx: Context) {}
284310

285-
#[options]
286311
#[route("/options")]
287312
#[response_body("options")]
313+
#[options]
288314
async fn options(ctx: Context) {}
289315

290-
#[patch]
291316
#[route("/patch")]
292317
#[response_body("patch")]
318+
#[patch]
293319
async fn patch(ctx: Context) {}
294320

295-
#[put]
296321
#[route("/put")]
297322
#[response_body("put")]
323+
#[put]
298324
async fn put(ctx: Context) {}
299325

300-
#[trace]
301326
#[route("/trace")]
302327
#[response_body("trace")]
328+
#[trace]
303329
async fn trace(ctx: Context) {}
304330

305-
#[h2c]
306331
#[route("/h2c")]
307332
#[response_body("h2c")]
333+
#[h2c]
308334
async fn h2c(ctx: Context) {}
309335

310-
#[http]
311336
#[route("/http")]
312337
#[response_body("http")]
338+
#[http]
313339
async fn http_only(ctx: Context) {}
314340

315-
#[http0_9]
316341
#[route("/http0_9")]
317342
#[response_body("http0.9")]
343+
#[http0_9]
318344
async fn http0_9(ctx: Context) {}
319345

320-
#[http1_0]
321346
#[route("/http1_0")]
322347
#[response_body("http1.0")]
348+
#[http1_0]
323349
async fn http1_0(ctx: Context) {}
324350

325-
#[http1_1]
326351
#[route("/http1_1")]
327352
#[response_body("http1.1")]
353+
#[http1_1]
328354
async fn http1_1(ctx: Context) {}
329355

330-
#[http2]
331356
#[route("/http2")]
332357
#[response_body("http2")]
358+
#[http2]
333359
async fn http2(ctx: Context) {}
334360

335-
#[http3]
336361
#[route("/http3")]
337362
#[response_body("http3")]
363+
#[http3]
338364
async fn http3(ctx: Context) {}
339365

340-
#[tls]
341366
#[route("/tls")]
342367
#[response_body("tls")]
368+
#[tls]
343369
async fn tls(ctx: Context) {}
344370

345371
#[http1_1_or_higher]
@@ -367,38 +393,38 @@ async fn unknown_version(ctx: Context) {}
367393
#[response_body("unknown all")]
368394
async fn unknown_all(ctx: Context) {}
369395

370-
#[ws]
371-
#[get]
372-
#[send_body]
373396
#[route("/get")]
397+
#[send_once_body]
374398
#[response_body("get")]
399+
#[ws]
400+
#[get]
375401
async fn get(ctx: Context) {}
376402

377-
#[post]
378403
#[send_once]
379404
#[route("/post")]
380405
#[response_body("post")]
406+
#[post]
381407
async fn post(ctx: Context) {}
382408

383-
#[ws]
384-
#[send_once_body]
409+
#[send_body]
385410
#[route("/websocket")]
386411
#[response_body("websocket")]
412+
#[ws]
387413
async fn websocket(ctx: Context) {}
388414

389-
#[route("/ctx_hook")]
390-
#[pre_hook(ctx_pre_hook)]
391-
#[post_hook(ctx_post_hook)]
415+
#[route("/hook")]
416+
#[pre_hook(pre_hook)]
417+
#[post_hook(post_hook)]
392418
#[response_body("Testing hook macro")]
393-
async fn ctx_hook(ctx: Context) {}
419+
async fn hook(ctx: Context) {}
394420

395-
#[http]
396421
#[closed]
397422
#[route("/get_post")]
398423
#[methods(get, post)]
399424
#[response_reason_phrase("OK")]
400425
#[response_status_code(200)]
401426
#[response_body("get_post")]
427+
#[http]
402428
async fn get_post(ctx: Context) {}
403429

404430
#[route("/attributes")]

0 commit comments

Comments
 (0)