fix GET when query is set
This commit is contained in:
parent
1da3cd2cef
commit
7d7dd0d64c
2 changed files with 5 additions and 3 deletions
|
@ -42,10 +42,11 @@ async fn graphql_handler_get(
|
|||
Extension(schema): Extension<Schema<query::Query, EmptyMutation, EmptySubscription>>,
|
||||
query: Query<Request>,
|
||||
) -> axum::response::Response {
|
||||
match query.operation_name {
|
||||
Some(_) => Json(schema.execute(query.0).await).into_response(),
|
||||
None => Redirect::to("/graphql/playground").into_response(),
|
||||
if query.query == "" {
|
||||
return Redirect::to("/graphql/playground").into_response();
|
||||
}
|
||||
|
||||
Json(schema.execute(query.0).await).into_response()
|
||||
}
|
||||
async fn graphql_playground() -> impl IntoResponse {
|
||||
Html(playground_source(GraphQLPlaygroundConfig::new("/graphql")))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue