Sha256: 7724bb03b6f46dd711663e6e0334a79d23b7bb0ab50e90344b129595fb3cd890

Contents?: true

Size: 323 Bytes

Versions: 12

Compression:

Stored size: 323 Bytes

Contents

module ContentTypeHelpers
  %w(put patch post delete).each do |method|
    define_method :"#{method}_with_json" do |uri, params = {}, env = {}, &block|
      params = params.to_json
      env['CONTENT_TYPE'] ||= 'application/json'
      send(method, uri, params, env, &block)
    end
  end
end

include(ContentTypeHelpers)

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
grape-0.19.0 spec/support/content_type_helpers.rb
grape-0.18.0 spec/support/content_type_helpers.rb
grape-0.17.0 spec/support/content_type_helpers.rb
grape-0.16.2 spec/support/content_type_helpers.rb
grape-0.16.1 spec/support/content_type_helpers.rb
grape-0.15.0 spec/support/content_type_helpers.rb
grape-0.14.0 spec/support/content_type_helpers.rb
grape-0.13.0 spec/support/content_type_helpers.rb
grape-0.12.0 spec/support/content_type_helpers.rb
grape-0.11.0 spec/support/content_type_helpers.rb
grape-0.10.1 spec/support/content_type_helpers.rb
grape-0.10.0 spec/support/content_type_helpers.rb