Class: GraphQL::PersistedQueries::Analyzers::HttpMethodValidator
- Inherits:
-
Object
- Object
- GraphQL::PersistedQueries::Analyzers::HttpMethodValidator
- Defined in:
- lib/graphql/persisted_queries/analyzers/http_method_validator.rb
Overview
Verifies that mutations are not executed using GET requests
Instance Method Summary collapse
-
#initialize(query) ⇒ HttpMethodValidator
constructor
A new instance of HttpMethodValidator.
- #perform ⇒ Object
Constructor Details
#initialize(query) ⇒ HttpMethodValidator
Returns a new instance of HttpMethodValidator.
8 9 10 |
# File 'lib/graphql/persisted_queries/analyzers/http_method_validator.rb', line 8 def initialize(query) @query = query end |
Instance Method Details
#perform ⇒ Object
12 13 14 15 16 |
# File 'lib/graphql/persisted_queries/analyzers/http_method_validator.rb', line 12 def perform return if !@query.context[:request]&.get? || !@query.mutation? GraphQL::AnalysisError.new("Mutations cannot be performed via HTTP GET") end |