Module: Hanami::Action::BodyParser::JSON Private

Defined in:
lib/hanami/action/body_parser/json.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Body parser for JSON request bodies.

Since:

  • 0.1.0

Class Method Summary collapse

Class Method Details

.call(body, _env) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0



12
13
14
15
16
# File 'lib/hanami/action/body_parser/json.rb', line 12

def self.call(body, _env)
  ::JSON.parse(body)
rescue ::JSON::ParserError => exception
  raise BodyParsingError, exception.message
end