Sha256: e4c7347d6045eb4bae39d1d1405191431541966e508ee67b23044ae2003a5d72

Contents?: true

Size: 411 Bytes

Versions: 13

Compression:

Stored size: 411 Bytes

Contents

# frozen_string_literal: true

module Grape
  module Parser
    module Json
      class << self
        def call(object, _env)
          ::Grape::Json.load(object)
        rescue ::Grape::Json::ParseError
          # handle JSON parsing errors via the rescue handlers or provide error message
          raise Grape::Exceptions::InvalidMessageBody.new('application/json')
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
grape-2.2.0 lib/grape/parser/json.rb
grape-2.1.3 lib/grape/parser/json.rb
grape-2.1.2 lib/grape/parser/json.rb
grape-2.1.1 lib/grape/parser/json.rb
grape-2.1.0 lib/grape/parser/json.rb
grape-2.0.0 lib/grape/parser/json.rb
grape-1.8.0 lib/grape/parser/json.rb
grape-1.7.1 lib/grape/parser/json.rb
grape-1.7.0 lib/grape/parser/json.rb
grape-1.6.2 lib/grape/parser/json.rb
grape-1.6.1 lib/grape/parser/json.rb
grape-1.6.0 lib/grape/parser/json.rb
grape-1.5.3 lib/grape/parser/json.rb