Class: Aws::RpcV2::ContentTypeHandler

Inherits:
Seahorse::Client::Handler show all
Defined in:
lib/aws-sdk-core/rpc_v2/content_type_handler.rb

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Handler

#handler

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Handler

#initialize, #inspect

Constructor Details

This class inherits a constructor from Seahorse::Client::Handler

Instance Method Details

#call(context) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/aws-sdk-core/rpc_v2/content_type_handler.rb', line 6

def call(context)
  content_type =
    if eventstream_input?(context)
      'application/vnd.amazon.eventstream'
    elsif !empty_input_structure?(context)
      'application/cbor'
    end
  accept =
    if eventstream_output?(context)
      'application/vnd.amazon.eventstream'
    end

  headers = context.http_request.headers
  headers['Content-Type'] ||= content_type if content_type
  headers['Accept'] ||= accept if accept
  @handler.call(context)
end