Created
March 14, 2018 01:09
-
-
Save ericmoritz/a095a4afe16b32fd6af8338baa2d5fd4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn login(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error>> { | |
let addr = req.state().addr.clone(); | |
// TODO: use a form instead of the JSON data because OAuth 2.0 password grant is a form post. | |
req.concat2() | |
.from_err() | |
.and_then(|body| urlencoded::from_bytes(&body)) | |
.map_err(error::ErrorBadRequest) | |
.and_then(move |lreq: user::PasswordGrantRequest| addr.send(lreq).from_err() ) | |
.and_then(|resp| httpcodes::HTTPOk.build().json(resp?)) | |
.from_err() | |
.responder() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Executing task: cargo test < | |
Compiling rs_events v0.1.0 (file:///home/eric/Documents/Projects/rs-events) | |
error[E0277]: the trait bound `serde_urlencoded::de::Error: std::convert::From<actix_web::error::PayloadError>` is not satisfied | |
--> src/services/user/web_app.rs:54:10 | |
| | |
54 | .and_then(|body| urlencoded::from_bytes(&body)) | |
| ^^^^^^^^ the trait `std::convert::From<actix_web::error::PayloadError>` is not implemented for `serde_urlencoded::de::Error` | |
| | |
= note: required because of the requirements on the impl of `futures::Future` for `futures::future::FromErr<futures::stream::Concat2<actix_web::HttpRequest<services::user::web_app::State>>, serde_urlencoded::de::Error>` | |
error[E0277]: the trait bound `serde_urlencoded::de::Error: std::convert::From<actix_web::error::PayloadError>` is not satisfied | |
--> src/services/user/web_app.rs:53:10 | |
| | |
53 | .from_err() | |
| ^^^^^^^^ the trait `std::convert::From<actix_web::error::PayloadError>` is not implemented for `serde_urlencoded::de::Error` | |
error[E0599]: no method named `map_err` found for type `futures::AndThen<futures::future::FromErr<futures::stream::Concat2<actix_web::HttpRequest<services::user::web_app::State>>, serde_urlencoded::de::Error>, std::result::Result<_, serde_urlencoded::de::Error>, [closure@src/services/user/web_app.rs:54:19: 54:55]>` in the current scope | |
--> src/services/user/web_app.rs:55:10 | |
| | |
55 | .map_err(error::ErrorBadRequest) | |
| ^^^^^^^ | |
| | |
= note: the method `map_err` exists but the following trait bounds were not satisfied: | |
`futures::AndThen<futures::future::FromErr<futures::stream::Concat2<actix_web::HttpRequest<services::user::web_app::State>>, serde_urlencoded::de::Error>, std::result::Result<_, serde_urlencoded::de::Error>, [closure@src/services/user/web_app.rs:54:19: 54:55]> : futures::Future` | |
`&mut futures::AndThen<futures::future::FromErr<futures::stream::Concat2<actix_web::HttpRequest<services::user::web_app::State>>, serde_urlencoded::de::Error>, std::result::Result<_, serde_urlencoded::de::Error>, [closure@src/services/user/web_app.rs:54:19: 54:55]> : futures::Future` | |
`&mut futures::AndThen<futures::future::FromErr<futures::stream::Concat2<actix_web::HttpRequest<services::user::web_app::State>>, serde_urlencoded::de::Error>, std::result::Result<_, serde_urlencoded::de::Error>, [closure@src/services/user/web_app.rs:54:19: 54:55]> : futures::Stream` | |
error: aborting due to 3 previous errors | |
error: Could not compile `rs_events`. | |
warning: build failed, waiting for other jobs to finish... | |
error[E0277]: the trait bound `serde_urlencoded::de::Error: std::convert::From<actix_web::error::PayloadError>` is not satisfied | |
--> src/services/user/web_app.rs:54:10 | |
| | |
54 | .and_then(|body| urlencoded::from_bytes(&body)) | |
| ^^^^^^^^ the trait `std::convert::From<actix_web::error::PayloadError>` is not implemented for `serde_urlencoded::de::Error` | |
| | |
= note: required because of the requirements on the impl of `futures::Future` for `futures::future::FromErr<futures::stream::Concat2<actix_web::HttpRequest<services::user::web_app::State>>, serde_urlencoded::de::Error>` | |
error[E0277]: the trait bound `serde_urlencoded::de::Error: std::convert::From<actix_web::error::PayloadError>` is not satisfied | |
--> src/services/user/web_app.rs:53:10 | |
| | |
53 | .from_err() | |
| ^^^^^^^^ the trait `std::convert::From<actix_web::error::PayloadError>` is not implemented for `serde_urlencoded::de::Error` | |
error[E0599]: no method named `map_err` found for type `futures::AndThen<futures::future::FromErr<futures::stream::Concat2<actix_web::HttpRequest<services::user::web_app::State>>, serde_urlencoded::de::Error>, std::result::Result<_, serde_urlencoded::de::Error>, [closure@src/services/user/web_app.rs:54:19: 54:55]>` in the current scope | |
--> src/services/user/web_app.rs:55:10 | |
| | |
55 | .map_err(error::ErrorBadRequest) | |
| ^^^^^^^ | |
| | |
= note: the method `map_err` exists but the following trait bounds were not satisfied: | |
`futures::AndThen<futures::future::FromErr<futures::stream::Concat2<actix_web::HttpRequest<services::user::web_app::State>>, serde_urlencoded::de::Error>, std::result::Result<_, serde_urlencoded::de::Error>, [closure@src/services/user/web_app.rs:54:19: 54:55]> : futures::Future` | |
`&mut futures::AndThen<futures::future::FromErr<futures::stream::Concat2<actix_web::HttpRequest<services::user::web_app::State>>, serde_urlencoded::de::Error>, std::result::Result<_, serde_urlencoded::de::Error>, [closure@src/services/user/web_app.rs:54:19: 54:55]> : futures::Stream` | |
`&mut futures::AndThen<futures::future::FromErr<futures::stream::Concat2<actix_web::HttpRequest<services::user::web_app::State>>, serde_urlencoded::de::Error>, std::result::Result<_, serde_urlencoded::de::Error>, [closure@src/services/user/web_app.rs:54:19: 54:55]> : futures::Future` | |
error: aborting due to 3 previous errors | |
error: Could not compile `rs_events`. | |
To learn more, run the command again with --verbose. | |
The terminal process terminated with exit code: 101 | |
Press any key to close the terminal. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment