class Jets::Controller::Request

def env

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

def headers

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

def initialize(event, context)

def initialize(event, context)
  @event, @context = event, context
  super(env)
end

def set_env!(env)

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