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.191.6 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.191.5 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.191.4 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.191.3 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.191.2 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.191.1 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.191.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.190.3 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.190.2 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.190.1 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.190.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.189.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.188.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.187.1 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.187.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.186.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.185.2 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.185.1 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.185.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb
aws-sdk-core-3.184.0 lib/aws-sdk-core/plugins/protocols/rest_json.rb