Class: Aws::RpcV2::ContentTypeHandler Private

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

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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'
    else
      'application/cbor'
    end

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