Closed ysulyma closed 1 year ago
@ysulyma /graphql?query
should work, but rocket
example is incorrect, as it uses Deserialize
impl of GraphQLRequest
. We'll address this in 0.16
release.
Until then you have 2 options:
POST
for both mutations and queries. This should be ok. Deserialize
impl and convert this struct into a GraphQLRequest
. @ysulyma
/graphql?query
should work, butrocket
example is incorrect, as it usesDeserialize
impl ofGraphQLRequest
.
This is not true. In the specified example is used juniper_rocket::GraphQLRequest
, rather than juniper::http::GraphQLRequest
, and it doesn't implement Deserialize
at all. In fact, it implements FromForm
, which gives it ability to being parsed from URL query strings. So all this works okay. Passing juniper::http::tests
confirms it.
The example, however, is really broken. Rather than having
#[rocket::get("/graphql?<request>")]
attribute, it should have
#[rocket::get("/graphql?<request..>")]
@ysulyma the example was fixed, and now mentions the GET request query format: https://github.com/graphql-rust/juniper/blob/bd8dc582a418f80d40a1b0ca969d3a6d4d77e2a6/juniper_rocket/examples/simple.rs#L29-L41
I am using the Juniper Rocket example. The POST endpoint and GraphiQL interface work for me, but I can't figure out how to send a GET request. (I'm also new to using Rocket.) I have tried
where {} is a URL-encoded version of
and none of these work for me.
An explicit example of a GET request that works would be helpful.