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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/api_proxy/headers_filter.rb +2 -2
- data/lib/api_proxy/response_builder.rb +1 -1
- data/lib/api_proxy/version.rb +1 -1
- data/lib/api_proxy.rb +4 -3
- 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: d61c5cf36f1ea1bd4f85ccc4dae8a44c5cbfbbd5ed90a46c271b3dd5b1e6488e
|
4
|
+
data.tar.gz: a79c2e0eec2d448f0e7f8d74aca1f2e6387d3a2fd2c009dc41c6f3e364c67bb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 913b636988ecb6e592a8e331a6531d01fae795513730d93e0eac22951a84e431996e230609e41b9e61be94313b6ca0f2b23e9da1f6831a5913e2420a87a70443
|
7
|
+
data.tar.gz: edef8ee9c18aaa5024e7479a8a33996b5c088e7d3506a4db27dc31fb77aa2ff429d88c3c3778a5115a0f282037e9032a8a81506f18713ad88aaefd801de3765e
|
data/Gemfile.lock
CHANGED
@@ -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,
|
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
|
62
|
+
response.headers.merge('content-length' => response.body&.size),
|
63
63
|
@config.allowed_headers
|
64
64
|
).filter
|
65
65
|
end
|
data/lib/api_proxy/version.rb
CHANGED
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
|
-
|
5
|
-
require 'active_support/
|
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.
|
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-
|
11
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|