Class: Hanami::Middleware::BodyParser::JsonParser Private
- Inherits:
-
Object
- Object
- Hanami::Middleware::BodyParser::JsonParser
- Defined in:
- lib/hanami/middleware/body_parser/json_parser.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #mime_types ⇒ Object private
-
#parse(body) ⇒ Hash
private
Parse a json string.
Instance Method Details
#mime_types ⇒ 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.
12 13 14 |
# File 'lib/hanami/middleware/body_parser/json_parser.rb', line 12 def mime_types ['application/json', 'application/vnd.api+json'] end |
#parse(body) ⇒ Hash
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.
Parse a json string
26 27 28 29 30 |
# File 'lib/hanami/middleware/body_parser/json_parser.rb', line 26 def parse(body) Hanami::Utils::Json.parse(body) rescue Hanami::Utils::Json::ParserError => e raise BodyParsingError.new(e.) end |