Sha256: 6da1ed8b4ae0840d35d61bd55f5a6d25f6147236afb5ac165f7d9d364610ffa5

Contents?: true

Size: 820 Bytes

Versions: 191

Compression:

Stored size: 820 Bytes

Contents

require 'rack/request'

class Jets::Controller
  class Request < ::Rack::Request
    def initialize(event, context)
      @event, @context = event, context
      super(env)
    end

    def env
      @env ||= Jets::Controller::Rack::Env.new(@event, @context).convert # convert to Rack env
    end

    # When request hits the middleware Controller::Rack::Middleware::Main endpoint
    # We set the it with the updated env since it could had been mutated down the
    # middleware stack.
    def set_env!(env)
      @env = env
    end

    # API Gateway is inconsistent about how it cases it keys.
    # Sometimes it is "x-requested-with" vs "X-Requested-With"
    # Normalize it with downcase.
    def headers
      headers = @event["headers"] || {}
      headers.transform_keys { |key| key.downcase }
    end
  end
end

Version data entries

191 entries across 191 versions & 4 rubygems

Version Path
jets-4.0.12 lib/jets/controller/request.rb
jets-4.0.11 lib/jets/controller/request.rb
jets-4.0.10 lib/jets/controller/request.rb
jets-4.0.9 lib/jets/controller/request.rb
jets-4.0.8 lib/jets/controller/request.rb
jets-4.0.7 lib/jets/controller/request.rb
jets-4.0.6 lib/jets/controller/request.rb
jets-4.0.5 lib/jets/controller/request.rb
jets-4.0.4 lib/jets/controller/request.rb
jets-4.0.3 lib/jets/controller/request.rb
jets-4.0.2 lib/jets/controller/request.rb
jets-4.0.1 lib/jets/controller/request.rb
jets-4.0.0 lib/jets/controller/request.rb
jets-3.2.2 lib/jets/controller/request.rb
jets-3.2.1 lib/jets/controller/request.rb
jets.benforeva-3.0.17.pre.mount.pre.fix lib/jets/controller/request.rb
jets-3.2.0 lib/jets/controller/request.rb
jets-3.1.5 lib/jets/controller/request.rb
jets-3.1.4 lib/jets/controller/request.rb
jets-3.1.3 lib/jets/controller/request.rb