Class: Lamby::RackRest

Inherits:
Rack
  • Object
show all
Defined in:
lib/lamby/rack_rest.rb

Constant Summary

Constants inherited from Rack

Lamby::Rack::HTTP_COOKIE, Lamby::Rack::HTTP_X_REQUESTID, Lamby::Rack::LAMBDA_CONTEXT, Lamby::Rack::LAMBDA_EVENT

Instance Attribute Summary

Attributes inherited from Rack

#context, #event

Instance Method Summary collapse

Methods inherited from Rack

#env, #initialize, #multi_value?

Methods included from SamHelpers

#sam_local?

Constructor Details

This class inherits a constructor from Lamby::Rack

Instance Method Details

#response(handler) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/lamby/rack_rest.rb', line 4

def response(handler)
  if handler.base64_encodeable?
    { isBase64Encoded: true, body: handler.body64 }
  else
    super
  end.tap do |r|
    if cookies = handler.set_cookies
      r[:multiValueHeaders] ||= {}
      r[:multiValueHeaders]['Set-Cookie'] = cookies
    end
  end
end