You are viewing documentation for version 3 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: Aws::Rest::Request::Headers

Inherits:
Object
  • Object
show all
Includes:
Seahorse::Model::Shapes
Defined in:
gems/aws-sdk-core/lib/aws-sdk-core/rest/request/headers.rb

Instance Method Summary collapse

Constructor Details

#initialize(rules) ⇒ Headers

Returns a new instance of Headers

Parameters:

  • rules (Seahorse::Model::ShapeRef)


12
13
14
# File 'gems/aws-sdk-core/lib/aws-sdk-core/rest/request/headers.rb', line 12

def initialize(rules)
  @rules = rules
end

Instance Method Details

#apply(http_req, params) ⇒ Object

Parameters:



18
19
20
21
22
23
24
25
26
27
# File 'gems/aws-sdk-core/lib/aws-sdk-core/rest/request/headers.rb', line 18

def apply(http_req, params)
  @rules.shape.members.each do |name, ref|
    value = params[name]
    next if value.nil?
    case ref.location
    when 'header' then apply_header_value(http_req.headers, ref, value)
    when 'headers' then apply_header_map(http_req.headers, ref, value)
    end
  end
end