hanami-lambda 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hanami/lambda/rack.rb +9 -3
- data/lib/hanami/lambda/version.rb +1 -1
- data/sig/hanami/lambda/rack.rbs +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5290d421a5921a83e73ef847aa3b761f78729ed6ffc33f91f61920bdf766a1d4
|
4
|
+
data.tar.gz: b3686c49f793cb2d8fd515263399c9d8505501be4857943fa665197dec6f73e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6caf8a054cb18911dc8eabe5a0a02b06c1adbba89eb7d8aceec1e53b037e5d5b17a9ce733b98f8fb9434e3751154499c311123d15fe48ea20edbfe1b4fb50de7
|
7
|
+
data.tar.gz: eed1763d24481397ada1a15130e94f898a08c5e616b62e3b8220510ee6f94fa5339638613dc5167696adbd41eeef9633d125b37a9d7ea34a90284b2235fbc92d
|
data/lib/hanami/lambda/rack.rb
CHANGED
@@ -24,7 +24,8 @@ module Hanami
|
|
24
24
|
#
|
25
25
|
# @since 0.1.0
|
26
26
|
def call(event:, context:)
|
27
|
-
|
27
|
+
headers = event["headers"] || {}
|
28
|
+
env = build_env(event, headers, context)
|
28
29
|
status_code, headers, body = app.call(env)
|
29
30
|
|
30
31
|
{
|
@@ -39,7 +40,7 @@ module Hanami
|
|
39
40
|
# @return [Hash] the Rack environment
|
40
41
|
#
|
41
42
|
# @since 0.1.0
|
42
|
-
def build_env(event, context)
|
43
|
+
def build_env(event, headers, context)
|
43
44
|
{
|
44
45
|
::Rack::REQUEST_METHOD => event["httpMethod"],
|
45
46
|
::Rack::PATH_INFO => event["path"] || "",
|
@@ -47,7 +48,12 @@ module Hanami
|
|
47
48
|
::Rack::RACK_INPUT => StringIO.new(event["body"] || ""),
|
48
49
|
::Hanami::Lambda::LAMBDA_EVENT => event,
|
49
50
|
::Hanami::Lambda::LAMBDA_CONTEXT => context
|
50
|
-
}
|
51
|
+
}.tap do |env|
|
52
|
+
content_type = headers.delete("Content-Type") ||
|
53
|
+
headers.delete("content-type") ||
|
54
|
+
headers.delete("CONTENT_TYPE")
|
55
|
+
env["CONTENT_TYPE"] = content_type if content_type
|
56
|
+
end.merge(headers)
|
51
57
|
end
|
52
58
|
end
|
53
59
|
end
|
data/sig/hanami/lambda/rack.rbs
CHANGED
@@ -26,7 +26,7 @@ module Hanami
|
|
26
26
|
# @return [Hash] the Rack environment
|
27
27
|
#
|
28
28
|
# @since 0.1.0
|
29
|
-
def build_env: (untyped event, untyped context) -> ::Hash[untyped, untyped]
|
29
|
+
def build_env: (untyped event, untyped headers, untyped context) -> ::Hash[untyped, untyped]
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-lambda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aotokitsuruya
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|