@@ -2,7 +2,7 @@ use std::error;
22
33use async_graphql:: { EmptyMutation , EmptySubscription , Schema } ;
44use axum:: http:: StatusCode ;
5- use axum:: response:: Html ;
5+ use axum:: response:: { Html , IntoResponse } ;
66use axum:: routing:: { get, post} ;
77use axum:: { Extension , Router } ;
88
@@ -57,6 +57,7 @@ async fn serve(config: GlazedConfig) -> Result<(), Box<dyn error::Error>> {
5757
5858 let app = Router :: new ( )
5959 . route ( "/graphql" , post ( graphql_handler) )
60+ . route ( "/graphql" , get ( graphql_get_warning) )
6061 . route ( "/graphiql" , get ( graphiql_handler) )
6162 . fallback ( (
6263 StatusCode :: NOT_FOUND ,
@@ -72,6 +73,14 @@ async fn serve(config: GlazedConfig) -> Result<(), Box<dyn error::Error>> {
7273 . await ?)
7374}
7475
76+ async fn graphql_get_warning ( ) -> impl IntoResponse {
77+ (
78+ StatusCode :: METHOD_NOT_ALLOWED ,
79+ [ ( "Allow" , "POST" ) ] ,
80+ Html ( include_str ! ( "../static/get_graphql_warning.html" ) ) ,
81+ )
82+ }
83+
7584async fn signal_handler ( ) {
7685 let mut term = signal ( SignalKind :: terminate ( ) ) . expect ( "Failed to create SIGTERM listener" ) ;
7786 let mut int = signal ( SignalKind :: interrupt ( ) ) . expect ( "Failed to create SIGINT listener" ) ;
0 commit comments