Class: Jets::Shim::Adapter::Apigw
- Inherits:
-
Web
- Object
- Base
- Web
- Jets::Shim::Adapter::Apigw
show all
- Defined in:
- lib/jets/shim/adapter/apigw.rb
Direct Known Subclasses
Alb
Instance Attribute Summary
Attributes inherited from Base
#context, #event, #target
Instance Method Summary
collapse
Methods inherited from Web
#base_env, #body, #content_length, #handle, #headers, #headers_env, #host, #http_cookie, #https, #remote_addr, #request_uri, #shim_host, #special_headers, #to_rack_env, #translate_response
Methods inherited from Base
#initialize
#log
Instance Method Details
#env ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/jets/shim/adapter/apigw.rb', line 4
def env
{
"HTTP_HOST" => host,
"HTTP_PORT" => ["X-Forwarded-Port"],
"HTTPS" => https,
"PATH_INFO" => path_info,
"QUERY_STRING" => query_string,
"REQUEST_METHOD" => event["httpMethod"] || "GET", "REQUEST_PATH" => path_info,
"SCRIPT_NAME" => "",
"SERVER_NAME" => host,
"SERVER_PORT" => ["X-Forwarded-Port"],
"SERVER_PROTOCOL" => event.dig("requestContext", "protocol") || "HTTP/1.1"
}
end
|
#handle? ⇒ Boolean
25
26
27
28
|
# File 'lib/jets/shim/adapter/apigw.rb', line 25
def handle?
host =~ /execute-api/ ||
event["resource"] && event.dig("requestContext", "stage")
end
|
#path_info ⇒ Object
21
22
23
|
# File 'lib/jets/shim/adapter/apigw.rb', line 21
def path_info
event["path"] || "/" end
|