Sha256: 1a4fe9c817ac2fa7adbe0ef38d48dcd01ddf79e624094b7e6227f869f3058b01

Contents?: true

Size: 926 Bytes

Versions: 7

Compression:

Stored size: 926 Bytes

Contents

module Aws
  module Json
    class RpcHeadersHandler < Seahorse::Client::Handler

      CONTENT_TYPE = 'application/x-amz-json-%s'

      # @param [Seahorse::Client::RequestContext] context
      # @return [Seahorse::Client::Response]
      def call(context)
        @handler.call(add_headers(context)).on(200..599) do |resp|
          context[:request_id] = context.http_response.headers['x-amzn-requestid']
        end
      end

      private

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

      def content_type(context)
        CONTENT_TYPE % [context.config.api.metadata('jsonVersion')]
      end

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

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
aws-sdk-core-2.0.48 lib/aws-sdk-core/json/rpc_headers_handler.rb
aws-sdk-core-2.0.47 lib/aws-sdk-core/json/rpc_headers_handler.rb
aws-sdk-core-2.0.46 lib/aws-sdk-core/json/rpc_headers_handler.rb
aws-sdk-core-2.0.45 lib/aws-sdk-core/json/rpc_headers_handler.rb
aws-sdk-core-2.0.44 lib/aws-sdk-core/json/rpc_headers_handler.rb
aws-sdk-core-2.0.43 lib/aws-sdk-core/json/rpc_headers_handler.rb
aws-sdk-core-2.0.42 lib/aws-sdk-core/json/rpc_headers_handler.rb