File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
cloudevents-sdk-actix-web/src
example-projects/actix-web-example/src Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 8
8
//!
9
9
//! #[post("/")]
10
10
//! async fn post_event(req: HttpRequest, payload: web::Payload) -> Result<String, actix_web::Error> {
11
- //! let event = req.into_event (payload).await?;
11
+ //! let event = req.to_event (payload).await?;
12
12
//! println!("Received Event: {:?}", event);
13
13
//! Ok(format!("{:?}", event))
14
14
//! }
Original file line number Diff line number Diff line change @@ -115,15 +115,15 @@ pub async fn request_to_event(
115
115
/// Extention Trait for [`HttpRequest`] which acts as a wrapper for the function [`request_to_event()`].
116
116
#[ async_trait( ?Send ) ]
117
117
pub trait RequestExt {
118
- async fn into_event (
118
+ async fn to_event (
119
119
& self ,
120
120
mut payload : web:: Payload ,
121
121
) -> std:: result:: Result < Event , actix_web:: error:: Error > ;
122
122
}
123
123
124
124
#[ async_trait( ?Send ) ]
125
125
impl RequestExt for HttpRequest {
126
- async fn into_event (
126
+ async fn to_event (
127
127
& self ,
128
128
payload : web:: Payload ,
129
129
) -> std:: result:: Result < Event , actix_web:: error:: Error > {
@@ -165,7 +165,7 @@ mod tests {
165
165
. header ( "ce-time" , time. to_rfc3339 ( ) )
166
166
. to_http_parts ( ) ;
167
167
168
- let resp = req. into_event ( web:: Payload ( payload) ) . await . unwrap ( ) ;
168
+ let resp = req. to_event ( web:: Payload ( payload) ) . await . unwrap ( ) ;
169
169
assert_eq ! ( expected, resp) ;
170
170
}
171
171
@@ -197,7 +197,7 @@ mod tests {
197
197
. set_json ( & j)
198
198
. to_http_parts ( ) ;
199
199
200
- let resp = req. into_event ( web:: Payload ( payload) ) . await . unwrap ( ) ;
200
+ let resp = req. to_event ( web:: Payload ( payload) ) . await . unwrap ( ) ;
201
201
assert_eq ! ( expected, resp) ;
202
202
}
203
203
}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use serde_json::json;
5
5
6
6
#[ post( "/" ) ]
7
7
async fn post_event ( req : HttpRequest , payload : web:: Payload ) -> Result < String , actix_web:: Error > {
8
- let event = req. into_event ( payload) . await ?;
8
+ let event = req. to_event ( payload) . await ?;
9
9
println ! ( "Received Event: {:?}" , event) ;
10
10
Ok ( format ! ( "{:?}" , event) )
11
11
}
You can’t perform that action at this time.
0 commit comments