Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup to follow C-CONV #87

Merged
merged 1 commit into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cloudevents-sdk-actix-web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//!
//! #[post("/")]
//! async fn post_event(req: HttpRequest, payload: web::Payload) -> Result<String, actix_web::Error> {
//! let event = req.into_event(payload).await?;
//! let event = req.to_event(payload).await?;
//! println!("Received Event: {:?}", event);
//! Ok(format!("{:?}", event))
//! }
Expand Down
8 changes: 4 additions & 4 deletions cloudevents-sdk-actix-web/src/server_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ pub async fn request_to_event(
/// Extention Trait for [`HttpRequest`] which acts as a wrapper for the function [`request_to_event()`].
#[async_trait(?Send)]
pub trait RequestExt {
async fn into_event(
async fn to_event(
&self,
mut payload: web::Payload,
) -> std::result::Result<Event, actix_web::error::Error>;
}

#[async_trait(?Send)]
impl RequestExt for HttpRequest {
async fn into_event(
async fn to_event(
&self,
payload: web::Payload,
) -> std::result::Result<Event, actix_web::error::Error> {
Expand Down Expand Up @@ -165,7 +165,7 @@ mod tests {
.header("ce-time", time.to_rfc3339())
.to_http_parts();

let resp = req.into_event(web::Payload(payload)).await.unwrap();
let resp = req.to_event(web::Payload(payload)).await.unwrap();
assert_eq!(expected, resp);
}

Expand Down Expand Up @@ -197,7 +197,7 @@ mod tests {
.set_json(&j)
.to_http_parts();

let resp = req.into_event(web::Payload(payload)).await.unwrap();
let resp = req.to_event(web::Payload(payload)).await.unwrap();
assert_eq!(expected, resp);
}
}
2 changes: 1 addition & 1 deletion example-projects/actix-web-example/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use serde_json::json;

#[post("/")]
async fn post_event(req: HttpRequest, payload: web::Payload) -> Result<String, actix_web::Error> {
let event = req.into_event(payload).await?;
let event = req.to_event(payload).await?;
println!("Received Event: {:?}", event);
Ok(format!("{:?}", event))
}
Expand Down