Sha256: e0a9705745b2334b0d00c22f0a1f16e1fea744a5da35a16e3293d53e52923459
Contents?: true
Size: 1.32 KB
Versions: 7
Compression:
Stored size: 1.32 KB
Contents
module Lamby class RackRest < Lamby::Rack 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 private def env_base { ::Rack::REQUEST_METHOD => event['httpMethod'], ::Rack::SCRIPT_NAME => '', ::Rack::PATH_INFO => event['path'] || '', ::Rack::QUERY_STRING => query_string, ::Rack::SERVER_NAME => headers['Host'], ::Rack::SERVER_PORT => headers['X-Forwarded-Port'], ::Rack::SERVER_PROTOCOL => event.dig('requestContext', 'protocol') || 'HTTP/1.1', ::Rack::RACK_VERSION => ::Rack::VERSION, ::Rack::RACK_URL_SCHEME => 'https', ::Rack::RACK_INPUT => StringIO.new(body || ''), ::Rack::RACK_ERRORS => $stderr, ::Rack::RACK_MULTITHREAD => false, ::Rack::RACK_MULTIPROCESS => false, ::Rack::RACK_RUNONCE => false, LAMBDA_EVENT => event, LAMBDA_CONTEXT => context }.tap do |env| ct = content_type cl = content_length env['CONTENT_TYPE'] = ct if ct env['CONTENT_LENGTH'] = cl if cl end end end end
Version data entries
7 entries across 7 versions & 1 rubygems