@@ -66,7 +66,7 @@ async fn test_forwarding_no_verification() {
66
66
. uri ( "/webhook/a" )
67
67
. method ( "POST" )
68
68
. header ( "content-type" , "application/json" )
69
- . body ( serde_json :: to_vec ( & json ! ( { "a" : true } ) ) . unwrap ( ) . into ( ) )
69
+ . body ( axum :: body :: Body :: from ( json ! ( { "a" : true } ) . to_string ( ) ) )
70
70
. unwrap ( ) ,
71
71
)
72
72
. await
@@ -110,7 +110,7 @@ async fn test_forwarding_multiple_receivers() {
110
110
. uri ( "/webhook/a" )
111
111
. method ( "POST" )
112
112
. header ( "content-type" , "application/json" )
113
- . body ( serde_json :: to_vec ( & json ! ( { "a" : true } ) ) . unwrap ( ) . into ( ) )
113
+ . body ( axum :: body :: Body :: from ( json ! ( { "a" : true } ) . to_string ( ) ) )
114
114
. unwrap ( ) ;
115
115
116
116
let response = ServiceExt :: < Request < Body > > :: ready ( & mut app)
@@ -128,7 +128,7 @@ async fn test_forwarding_multiple_receivers() {
128
128
. uri ( "/webhook/b" )
129
129
. method ( "POST" )
130
130
. header ( "content-type" , "application/json" )
131
- . body ( serde_json :: to_vec ( & json ! ( { "b" : true } ) ) . unwrap ( ) . into ( ) )
131
+ . body ( axum :: body :: Body :: from ( json ! ( { "b" : true } ) . to_string ( ) ) )
132
132
. unwrap ( ) ;
133
133
134
134
let response = ServiceExt :: < Request < Body > > :: ready ( & mut app)
@@ -200,7 +200,7 @@ async fn test_transformation_json() {
200
200
. uri ( "/webhook/transformed" )
201
201
. method ( "POST" )
202
202
. header ( "content-type" , "application/json" )
203
- . body ( serde_json :: to_vec ( & json ! ( { "a" : true } ) ) . unwrap ( ) . into ( ) )
203
+ . body ( axum :: body :: Body :: from ( json ! ( { "a" : true } ) . to_string ( ) ) )
204
204
. unwrap ( ) ;
205
205
206
206
let response = ServiceExt :: < Request < Body > > :: ready ( & mut app)
@@ -222,7 +222,7 @@ async fn test_transformation_json() {
222
222
. uri ( "/webhook/as-is" )
223
223
. method ( "POST" )
224
224
. header ( "content-type" , "application/json" )
225
- . body ( serde_json :: to_vec ( & json ! ( { "b" : true } ) ) . unwrap ( ) . into ( ) )
225
+ . body ( axum :: body :: Body :: from ( json ! ( { "b" : true } ) . to_string ( ) ) )
226
226
. unwrap ( ) ;
227
227
228
228
let response = ServiceExt :: < Request < Body > > :: ready ( & mut app)
@@ -280,7 +280,7 @@ async fn test_transformation_string() {
280
280
. uri ( "/webhook/transformed" )
281
281
. method ( "POST" )
282
282
. header ( "content-type" , "text/plain" )
283
- . body ( "plain text" . as_bytes ( ) . into ( ) )
283
+ . body ( axum :: body :: Body :: from ( "plain text" ) )
284
284
. unwrap ( ) ;
285
285
286
286
let response = ServiceExt :: < Request < Body > > :: ready ( & mut app)
@@ -337,7 +337,7 @@ async fn test_forwarding_svix_verification_mismatch() {
337
337
. header ( "svix-id" , "msg_valid" )
338
338
. header ( "svix-signature" , signature. clone ( ) )
339
339
. header ( "svix-timestamp" , & format ! ( "{timestamp}" ) )
340
- . body ( sent_payload_bytes . into ( ) )
340
+ . body ( axum :: body :: Body :: from ( sent_payload_bytes ) )
341
341
. unwrap ( ) ,
342
342
)
343
343
. await
@@ -383,13 +383,13 @@ async fn test_forwarding_svix_verification_match() {
383
383
. header ( "content-type" , "application/json" )
384
384
. header ( "svix-id" , "msg_valid" )
385
385
. header ( "svix-signature" , signature. clone ( ) )
386
- . header ( "svix-timestamp" , & format ! ( "{ timestamp}" ) )
387
- . body ( payload_bytes . into ( ) )
386
+ . header ( "svix-timestamp" , timestamp. to_string ( ) )
387
+ . body ( axum :: body :: Body :: from ( payload_bytes ) )
388
388
. unwrap ( ) ,
389
389
)
390
390
. await
391
391
. unwrap ( ) ;
392
392
assert_eq ! ( response. status( ) , StatusCode :: NO_CONTENT ) ;
393
393
let forwarded = a_rx. try_recv ( ) . unwrap ( ) ;
394
- assert_eq ! ( json!( forwarded) , json!( { "a" : true } ) ) ;
394
+ assert_eq ! ( json!( forwarded) , json!( { "a" : true } ) ) ;
395
395
}
0 commit comments