Skip to content

Commit

Permalink
warning with graphql get requests. #270
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed May 14, 2019
1 parent afc0df1 commit d337338
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/controllers/index_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ def index
# def routing_error
# fail ActionController::RoutingError
# end

def method_not_allowed
response.set_header('Allow', 'POST')
render json: { "message": "This endpoint only supports POST requests." }.to_json, status: :method_not_allowed
end
end
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Rails.application.routes.draw do
post "/graphql", to: "graphql#execute"
get "/graphql", to: "index#method_not_allowed"

root :to => 'index#index'

# authentication
Expand Down

0 comments on commit d337338

Please sign in to comment.