Use double quotes in controllers/
This commit is contained in:
@@ -12,11 +12,11 @@ class GraphqlController < ApplicationController
|
||||
response = consul_schema.execute query_string, variables: query_variables
|
||||
render json: response, status: :ok
|
||||
rescue GraphqlController::QueryStringError
|
||||
render json: { message: 'Query string not present' }, status: :bad_request
|
||||
render json: { message: "Query string not present" }, status: :bad_request
|
||||
rescue JSON::ParserError
|
||||
render json: { message: 'Error parsing JSON' }, status: :bad_request
|
||||
render json: { message: "Error parsing JSON" }, status: :bad_request
|
||||
rescue GraphQL::ParseError
|
||||
render json: { message: 'Query string is not valid JSON' }, status: :bad_request
|
||||
render json: { message: "Query string is not valid JSON" }, status: :bad_request
|
||||
rescue
|
||||
unless Rails.env.production? then raise end
|
||||
end
|
||||
@@ -36,7 +36,7 @@ class GraphqlController < ApplicationController
|
||||
end
|
||||
|
||||
def query_string
|
||||
if request.headers["CONTENT_TYPE"] == 'application/graphql'
|
||||
if request.headers["CONTENT_TYPE"] == "application/graphql"
|
||||
request.body.string # request.body.class => StringIO
|
||||
else
|
||||
params[:query]
|
||||
@@ -44,7 +44,7 @@ class GraphqlController < ApplicationController
|
||||
end
|
||||
|
||||
def query_variables
|
||||
if params[:variables].blank? || params[:variables] == 'null'
|
||||
if params[:variables].blank? || params[:variables] == "null"
|
||||
{}
|
||||
else
|
||||
JSON.parse(params[:variables])
|
||||
|
||||
Reference in New Issue
Block a user