Sha256: 3271244644eb80ffabf921a56f37099001081553868bbfb4133b72f7ebd402bd

Contents?: true

Size: 852 Bytes

Versions: 10

Compression:

Stored size: 852 Bytes

Contents

module Aws
  module Plugins

    # This plugin applies the "X-Amz-Target" and "Content-Type" headers
    # for AWS JSON Rpc style APIs.
    class JsonRpcHeaders < Seahorse::Client::Plugin

      # @api private
      class Handler < Seahorse::Client::Handler

        def call(context)
          context.http_request.headers['X-Amz-Target'] = target(context)
          context.http_request.headers['Content-Type'] = content_type(context)
          @handler.call(context)
        end

        def target(context)
          prefix = context.config.api.metadata['json_target_prefix']
          "#{prefix}.#{context.operation.name}"
        end

        def content_type(context)
          version = context.config.api.metadata['json_version']
          "application/x-amz-json-#{version}"
        end

      end

      handler(Handler)

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
aws-sdk-core-2.0.0.rc10 lib/aws/plugins/json_rpc_headers.rb
aws-sdk-core-2.0.0.rc9 lib/aws/plugins/json_rpc_headers.rb
aws-sdk-core-2.0.0.rc8 lib/aws/plugins/json_rpc_headers.rb
aws-sdk-core-2.0.0.rc7 lib/aws/plugins/json_rpc_headers.rb
aws-sdk-core-2.0.0.rc6 lib/aws/plugins/json_rpc_headers.rb
aws-sdk-core-2.0.0.rc5 lib/aws/plugins/json_rpc_headers.rb
aws-sdk-core-2.0.0.rc4 lib/aws/plugins/json_rpc_headers.rb
aws-sdk-core-2.0.0.rc3 lib/aws/plugins/json_rpc_headers.rb
aws-sdk-core-2.0.0.rc2 lib/aws/plugins/json_rpc_headers.rb
aws-sdk-core-2.0.0.rc1 lib/aws/plugins/json_rpc_headers.rb