Closed sync closed 4 years ago
I've tried the following
pub async fn graphql(
(schema, builder): (
Schema<QueryRoot, MutationRoot, EmptySubscription>,
QueryBuilder,
),
) -> Result<impl warp::Reply, warp::reject::Rejection> {
let resp = builder.execute_stream(&schema).await;
let stream: GQLResponseStream = resp.into();
Ok(warp::reply::json(stream).into_response())
}
obviously this isn't proper: Ok(warp::reply::json(stream).into_response())
GQLResponseStream
implements Reply
, so you should use it as follows.
let stream: GQLResponseStream = resp.into();
Ok(stream.into_response())
Fantastic it worked thanks
I'll try to submit an example repo this week end
I'll try to submit an example repo this week end
Thank you! 😁
I looked at this pr: https://github.com/async-graphql/async-graphql/commit/467a6119bf689c6ecf59b098f73f457fc18349a0
And here: https://github.com/async-graphql/examples/blob/ec71db917151076ced0a273eaf928a54c643cf67/actix-web/defer/src/main.rs
But i can't put the pieces back together for warp.