api_proxy 0.2.8 → 0.2.9

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: e5eef0dded505216ee8d17ccc306b16854efd171f3971e45901410225810adb5
4
- data.tar.gz: 29704f1f5c053fc93247930fbf912a3a6484501b0cedb04862a0b19061044bcf
3
+ metadata.gz: d61c5cf36f1ea1bd4f85ccc4dae8a44c5cbfbbd5ed90a46c271b3dd5b1e6488e
4
+ data.tar.gz: a79c2e0eec2d448f0e7f8d74aca1f2e6387d3a2fd2c009dc41c6f3e364c67bb4
5
5
  SHA512:
6
- metadata.gz: a74b708a2d35a0d8d078acba1d9b601135e0396164ef695a84e3eb29114790e2f9ac8265c8a3ecc43370241ca6d11207e9454dfd5142f05247e4d43833a68760
7
- data.tar.gz: ecc004d5c99b8cae0030ee28c0fa3b70a54d7aebcceef20cd2d489707ee2b1f82bbde82ff98e92f2de0a6f2544003916c08ad07dca518a99fc1509ade5f24ace
6
+ metadata.gz: 913b636988ecb6e592a8e331a6531d01fae795513730d93e0eac22951a84e431996e230609e41b9e61be94313b6ca0f2b23e9da1f6831a5913e2420a87a70443
7
+ data.tar.gz: edef8ee9c18aaa5024e7479a8a33996b5c088e7d3506a4db27dc31fb77aa2ff429d88c3c3778a5115a0f282037e9032a8a81506f18713ad88aaefd801de3765e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- api_proxy (0.2.8)
4
+ api_proxy (0.2.9)
5
5
  activesupport (>= 4.0)
6
6
  api_signature (~> 0.1.2)
7
7
  httparty (>= 0.15)
@@ -2,13 +2,13 @@
2
2
 
3
3
  module ApiProxy
4
4
  class HeadersFilter
5
- def initialize(headers, allowed_headers)
5
+ def initialize(headers, allowed_headers = [])
6
6
  @headers = headers
7
7
  @allowed_headers = allowed_headers
8
8
  end
9
9
 
10
10
  def filter
11
- @headers.select { |key, _value| @allowed_headers.include?(key) }
11
+ @headers.select { |key, value| @allowed_headers.include?(key) && value.present? }
12
12
  .transform_values { |value| Array(value)[0] }
13
13
  end
14
14
  end
@@ -59,7 +59,7 @@ module ApiProxy
59
59
 
60
60
  def response_headers(response)
61
61
  ApiProxy::HeadersFilter.new(
62
- response.headers.merge('content-length' => response.body.size),
62
+ response.headers.merge('content-length' => response.body&.size),
63
63
  @config.allowed_headers
64
64
  ).filter
65
65
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ApiProxy
4
- VERSION = '0.2.8'
4
+ VERSION = '0.2.9'
5
5
  end
data/lib/api_proxy.rb CHANGED
@@ -1,11 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'api_proxy/version'
4
- require 'active_support/time'
5
- require 'active_support/time_with_zone'
6
- require 'active_support/core_ext/module'
4
+
5
+ require 'active_support/all'
7
6
 
8
7
  module ApiProxy
8
+ extend ActiveSupport::Autoload
9
+
9
10
  autoload :Config, 'api_proxy/config'
10
11
  autoload :Middleware, 'api_proxy/middleware'
11
12
  autoload :HeadersFilter, 'api_proxy/headers_filter'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Malinovskiy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-03 00:00:00.000000000 Z
11
+ date: 2024-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler