Class: FDK::OutHeaders

Inherits:
InHeaders show all
Defined in:
lib/fdk/context.rb

Overview

Represents outbound HTTP headers

Instance Method Summary collapse

Methods inherited from InHeaders

#[], #each, #header_key

Constructor Details

#initialize(headers, key_in_fn) ⇒ OutHeaders

Returns a new instance of OutHeaders.



53
54
55
56
57
# File 'lib/fdk/context.rb', line 53

def initialize(headers, key_in_fn)
  headers["Fn-Fdk-Version"] = ["fdk-ruby/#{FDK::VERSION}"]
  headers["Fn-Fdk-Runtime"] = ["ruby/#{RUBY_VERSION}"]
  super(headers, key_in_fn)
end

Instance Method Details

#[]=(key, value) ⇒ Object



59
60
61
62
63
64
65
66
67
# File 'lib/fdk/context.rb', line 59

def []=(key, value)
  if value.is_a? Array
    h = []
    value.each { |x| h.push(x.to_s) }
    @headers[header_key(key)] = h
  else
    @headers[header_key(key)] = [value.to_s]
  end
end

#delete(key) ⇒ Object



69
70
71
# File 'lib/fdk/context.rb', line 69

def delete(key)
  @headers.delete header_key(key)
end