actix-web client: How to move beyond simple example

Thanks, I kind of got that far, but got lost in the complexity. I guess I was seeing too many new things at a time, and lost track.

Indeed, the json and body methods state they wait for the entire payload. I missed that body returns a concrete type (namely Bytes, by means of an associated type Item). Rust docs can be daunting if most of the types on the page are new to you.

Do I simply chain a .then(my_closure) after it, like this:

        .header("Accept", "application/json")
        .finish().unwrap() // FIXME: propagate error
        .map_err(|_| (/* FIXME: propagate error */)
        .then(|response_body_or_err| my_actor.send(SomeMessage(response_body_or_err)))


If I understand actix futures correctly, this expression returns a future, and if I spawn that on an Arbiter, it will be run in the System. Is that correct?

/r/actix Thread Parent