Class: Hanami::Middleware::BodyParser::JsonParser Private
- 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.
Constant Summary collapse
- MEDIA_TYPES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
["application/json", "application/vnd.api+json"].freeze
Instance Attribute Summary
Attributes inherited from Parser
Class Method Summary collapse
- .media_types ⇒ Object private
Instance Method Summary collapse
-
#parse(body) ⇒ Hash
private
Parse a json string.
Methods inherited from Parser
Constructor Details
This class inherits a constructor from Hanami::Middleware::BodyParser::Parser
Class Method Details
.media_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.
16 |
# File 'lib/hanami/middleware/body_parser/json_parser.rb', line 16 def self.media_types = MEDIA_TYPES |
Instance Method Details
#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
28 29 30 31 32 |
# File 'lib/hanami/middleware/body_parser/json_parser.rb', line 28 def parse(body, *) JSON.parse(body) rescue StandardError => exception raise BodyParsingError.new(exception.) end |