Sha256: 7c56adf51fa35e47918217c215b06f7da5e6a4b63198839883c900ddb0bf27d6
Contents?: true
Size: 796 Bytes
Versions: 19
Compression:
Stored size: 796 Bytes
Contents
require 'hanami/utils/json' module Hanami module Routing module Parsing # @since 0.2.0 # @api private class JsonParser < Parser # @since 0.2.0 # @api private def mime_types ['application/json', 'application/vnd.api+json'] end # Parse a json string # # @param body [String] a json string # # @return [Hash] the parsed json # # @raise [Hanami::Routing::Parsing::BodyParsingError] when the body can't be parsed. # # @since 0.2.0 # @api private def parse(body) Hanami::Utils::Json.parse(body) rescue Hanami::Utils::Json::ParserError => e raise BodyParsingError.new(e.message) end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems