Commit 510ab23c authored by Samir Noir's avatar Samir Noir 🧀
Browse files

Remove useless parse_json_payload method

Rails already had the parsed payload to params
parent caee9f1c
......@@ -20,7 +20,6 @@ class ApplicationController < ActionController::Base
protect_from_forgery unless: -> { request.format.json? }
before_action :lookup_credentials
before_action :parse_json_payload, only: %i[create update destroy]
before_action :set_default_format
# additional classes introduced to handle all possible exceptions
......@@ -177,16 +176,6 @@ class ApplicationController < ActionController::Base
end
end
# Automatically parse JSON payload when request content type is JSON
def parse_json_payload
if request.content_type =~ %r{application/.*json}i
json = JSON.parse(request.body.read)
params.merge!(json)
end
ensure
request.body.rewind
end
def render_error(exception, options = {})
log_exception(exception)
message = options[:message] || exception.message
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment