@@ -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
@@ -56,7 +56,7 @@ async fn serve(config: GlazedConfig) -> Result<(), Box<dyn error::Error>> {
5656 . finish ( ) ;
5757
5858 let app = Router :: new ( )
59- . route ( "/graphql" , post ( graphql_handler) )
59+ . route ( "/graphql" , post ( graphql_handler) . get ( graphql_get_warning ) )
6060 . route ( "/graphiql" , get ( graphiql_handler) )
6161 . fallback ( (
6262 StatusCode :: NOT_FOUND ,
@@ -72,6 +72,14 @@ async fn serve(config: GlazedConfig) -> Result<(), Box<dyn error::Error>> {
7272 . await ?)
7373}
7474
75+ async fn graphql_get_warning ( ) -> impl IntoResponse {
76+ (
77+ StatusCode :: METHOD_NOT_ALLOWED ,
78+ [ ( "Allow" , "POST" ) ] ,
79+ Html ( include_str ! ( "../static/get_graphql_warning.html" ) ) ,
80+ )
81+ }
82+
7583async fn signal_handler ( ) {
7684 let mut term = signal ( SignalKind :: terminate ( ) ) . expect ( "Failed to create SIGTERM listener" ) ;
7785 let mut int = signal ( SignalKind :: interrupt ( ) ) . expect ( "Failed to create SIGINT listener" ) ;
0 commit comments