roda-proxy 1.0.4 → 1.0.5

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: 5cf8112ba3a7b3a8d34302c882f42c66cfe2cd30e02dbc309848b3bbe0340fa7
4
- data.tar.gz: 5b8616ac8d12bf2a3832e1e3a87a8daa0d3f298d4b1bc2d3292f44e5a8de16c8
3
+ metadata.gz: eb409e70001e1014f578c5e960645dfec420ad322f9b7c3561fff14d4349d0ae
4
+ data.tar.gz: 3d77b1f29d562da8445c7bb18b2ccb58b1f021c6c67324b88c5628179c47c4d6
5
5
  SHA512:
6
- metadata.gz: 0a72cb9efd6c2a99628a8a351f59aff2ee0e3628edbffd3175d0a399633fe827058f601028fae15d698c946d9eaef0e257969e363c41b6c714b6e0426a0ac13d
7
- data.tar.gz: 7e683bdaa7911a1446ab3ec53b886356fd38d5b55dc8f849055858e7cc028207d3a0427a1aa4dd995a0da440da412885e11a1f2f0257135e92e507666e165e2d
6
+ metadata.gz: 79a72f29b5d54ad614cedb19fbb0cfedb5a728673e9047ea8e980873c6d48b49ea524fe35a7dda90caae0d9cd0504461ae3a521fbfbaad4016bcf9b262ea0fe3
7
+ data.tar.gz: f3e579a5517cd87f59125c276ca006e21b09ed738a8e99deaa8b6c1f051485f4b384ff068d418721b051a79223377242cd89d030eec540ced0e0a1b7e6dfe4a2
data/README.md CHANGED
@@ -58,7 +58,7 @@ route do |r|
58
58
  end
59
59
  ```
60
60
 
61
- The proxy will always be invoked. Headers and body are passed through unmodified in both directions with the exception of `Host` which is rewritten to match the target.
61
+ The proxy will always be invoked. Headers and body are passed through unmodified in both directions with the exception of `Host` which is rewritten to match the target and `Via` which is created (or appended to if it already exists) to indicate the proxy path.
62
62
 
63
63
  Also provided is a conditional proxy:
64
64
 
@@ -82,7 +82,7 @@ route do |r|
82
82
  end
83
83
  ```
84
84
 
85
- With `proxy_when` the first optional parameter expects a truthy value or a block / lambda that returns a truthy value. This must be equivalent to `true` for the proxying to occur. The optional probability is a float between 0 and 1 indicating the probability that proxying will happen. Both paramters can be used alone or in isolation.
85
+ With `proxy_when` the first optional parameter expects a truthy value or a block / lambda that returns a truthy value. This must be equivalent to `true` for the proxying to occur. The optional probability is a float between 0 and 1 indicating the probability that proxying will happen. Both parameters can be used alone or in isolation.
86
86
 
87
87
  If and only if proxying does not occur will the block be evaluated and return to Roda for rendering.
88
88
 
@@ -37,6 +37,7 @@ class Roda
37
37
  def proxy
38
38
  method = Faraday.method(env['REQUEST_METHOD'].downcase.to_sym)
39
39
  f_response = method.call(_proxy_url) { |req| _proxy_request(req) }
40
+ # p f_response
40
41
  _respond(f_response)
41
42
  end
42
43
 
@@ -92,7 +93,10 @@ class Roda
92
93
 
93
94
  def _respond(proxied_response)
94
95
  response.status = proxied_response.status
95
- proxied_response.headers.each { |k, v| response[k] = v }
96
+ proxied_response
97
+ .headers
98
+ .reject { |k, v| k.downcase == 'transfer-encoding' }
99
+ .each { |k, v| response[k] = v }
96
100
  response['Via'] = _via_header_string
97
101
  response.write(proxied_response.body)
98
102
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  class Roda
4
4
  module Proxy
5
- VERSION = '1.0.4'
5
+ VERSION = '1.0.5'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roda-proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Brookes-Thomas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-13 00:00:00.000000000 Z
11
+ date: 2020-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday