Sha256: 0d9a6c3e272a5cbee17609e3ee71def3482a412787c91492dd69fa9f41f83e6a

Contents?: true

Size: 838 Bytes

Versions: 120

Compression:

Stored size: 838 Bytes

Contents

# frozen_string_literal: true

module Aws
  module Plugins
    module Protocols
      class RestJson < Seahorse::Client::Plugin

        class ContentTypeHandler < Seahorse::Client::Handler
          def call(context)
            body = context.http_request.body
            # Rest::Handler will set a default JSON body, so size can be checked
            # if this handler is run after serialization.
            if !body.respond_to?(:size) ||
               (body.respond_to?(:size) && body.size > 0)
              context.http_request.headers['Content-Type'] ||=
                'application/json'
            end
            @handler.call(context)
          end
        end

        handler(Rest::Handler)
        handler(ContentTypeHandler, priority: 30)
        handler(Json::ErrorHandler, step: :sign)
      end

    end
  end
end

Version data entries

120 entries across 120 versions & 1 rubygems

Version Path
aws-sdk-core-3.138.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.137.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.136.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.135.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.134.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.133.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.132.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.131.6 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.131.5 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.131.4 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.131.3 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.131.2 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.131.1 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.131.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.130.2 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.130.1 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.130.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.129.1 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.129.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.128.1 lib/aws-sdk-core/plugins/protocols/rest_json.rb