hanami-lambda 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d92cc04b22fe527bdbc9e9a09f08fa7ac0497edd888f63feaac59eabdb3758eb
4
- data.tar.gz: 32442bf8245dbe01c98f4e21168ffe34f7b6b85e7f8418915e5c17af0694c7b4
3
+ metadata.gz: d79f8deb05e6842cbcda2d3088f86abeef6c66c9e9d1aa5c2d8b9c978309eee7
4
+ data.tar.gz: 9f119eee452349d784367c8f6d1d0e6dbb449ccffad07d54fce2736c1e382d3a
5
5
  SHA512:
6
- metadata.gz: e45dc7a58552b2f9612d8f32de3fcc2111696db8e31dbc96219703caa8484bd31ab29a94fedb4f48eae00edf02eba3bf10e835381d69459fcd83f540abfbd1c2
7
- data.tar.gz: a57c0a05b04a9e334da771445ee08a12d5ad4381365156e481c87af3a90fdc99d03d6e8f3d3b9497c5612954c745d0d6021e67f365a6c2c934f07e5bde7fd69a
6
+ metadata.gz: d5ae9124e698c6932e403cb5dbbf14ea366426bc1a9c75a92428d4d0857fae7f6ab822e23cdeae5049b2f8ca51c79aa50d5d4d0789b22e89bacb770e409acd76
7
+ data.tar.gz: a8c9d741f21d96269dbd557343d4fc0574b84d91550f4ea58016eda5b3feda92c1f75e64d28e1cf14ff2ef1c5df353d379c5ae56782cb78f047f2b8b766cf1c5
@@ -24,7 +24,8 @@ module Hanami
24
24
  #
25
25
  # @since 0.1.0
26
26
  def call(event:, context:)
27
- env = build_env(event, context)
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"] || "",
@@ -48,9 +49,11 @@ module Hanami
48
49
  ::Hanami::Lambda::LAMBDA_EVENT => event,
49
50
  ::Hanami::Lambda::LAMBDA_CONTEXT => context
50
51
  }.tap do |env|
51
- content_type = event.dig("headers", "Content-Type")
52
+ content_type = headers.delete("Content-Type") ||
53
+ headers.delete("content-type") ||
54
+ headers.delete("CONTENT_TYPE")
52
55
  env["CONTENT_TYPE"] = content_type if content_type
53
- end
56
+ end.merge(headers.transform_keys { |k| "HTTP_#{k.upcase.tr('-', '_')}" })
54
57
  end
55
58
  end
56
59
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Hanami
4
4
  module Lambda
5
- VERSION = "0.2.2"
5
+ VERSION = "0.2.4"
6
6
  end
7
7
  end
@@ -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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-lambda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aotokitsuruya