quilt_rails 3.4.2 → 3.5.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: 4740cbe3dcb527f279be3289d9d71097f92bb5a943378690234617dace12fe0e
4
- data.tar.gz: c0560de0c9e8504d5ccc645be4fb57205560aeace2ba5e9fe4437f71374d394c
3
+ metadata.gz: 985ac6397a1ae2309985f981da8b7047271a027660f6d2804cc05332759c9a8b
4
+ data.tar.gz: ad3c0239d187889ed082a2c5a8196e2308f17c7e7a3178a4dff7a0f878dab986
5
5
  SHA512:
6
- metadata.gz: 1ef599968c2e5a615e2a747555694284482ff99c5e0ee4dd323173b9ff2660857fad0582592990544e81fcc40af73bbd1f3a5525ba4943152955b604881f7922
7
- data.tar.gz: 13c3210ed0ab6a7c70b477a33b6208497b8412f6ad2316441b5418da0ba0db8e6141de86f8e1853be75040b5bbe079231e70b0962efcbda250d26844d68a391c
6
+ metadata.gz: a5668a48c0b9a57ed86e3ffc12fd183cf44465fd34955d37ecdf23feccb5e706668388719696a4f5e8277d2d1350e5ac5a49d9b9c2b648c299737073745ea6bc
7
+ data.tar.gz: d9c2d99bfc96e57eb81c14c470d95490d55040e70c096a440e3d8e4607106d0d9b3ac944fa106fd07a7ed4a0d8cf2a3527384b3b39637b6940d3e43abffde649
data/README.md CHANGED
@@ -171,7 +171,7 @@ In some cases you may want to send basic data from Rails to your React server. Q
171
171
 
172
172
  **Note:** The data passed should be data that is unlikely or will never change over the course of the session before they render any React components.
173
173
 
174
- **Note:** Please note the minimal dependencies require to use this feature is listed in [CHANGELOG](./CHANGELOG.md#[1.12.0]-2020-05-07)
174
+ **Note:** Please note the minimal dependencies require to use this feature is listed in [CHANGELOG](./CHANGELOG.md#1.12.0-2020-05-07)
175
175
 
176
176
  ```ruby
177
177
  class ReactController < ApplicationController
@@ -13,6 +13,7 @@ module Quilt
13
13
  self.react_server_protocol = ENV['REACT_SERVER_PROTOCOL'] || "http"
14
14
  self.logger = ::Logger.new($stdout)
15
15
  self.mount = true
16
+ self.allow_integration_test = false
16
17
  end
17
18
 
18
19
  def mount?
@@ -7,7 +7,9 @@ module Quilt
7
7
  include ReverseProxy::Controller
8
8
 
9
9
  def render_react(headers: {}, data: {})
10
- raise DoNotIntegrationTestError if Rails.env.test?
10
+ if Rails.env.test? && !Quilt.configuration.allow_integration_test
11
+ raise DoNotIntegrationTestError
12
+ end
11
13
 
12
14
  # Allow concurrent loading to prevent this thread from blocking class
13
15
  # loading in controllers called by the Node server.
@@ -20,7 +22,8 @@ module Quilt
20
22
 
21
23
  def call_proxy(headers, data)
22
24
  if defined? ShopifySecurityBase
23
- ShopifySecurityBase::HTTPHostRestriction.whitelist([Quilt.configuration.react_server_host]) do
25
+ allowlist = ShopifySecurityBase::HTTPHostRestriction.respond_to?(:allowlist) ? :allowlist : :whitelist
26
+ ShopifySecurityBase::HTTPHostRestriction.send(allowlist, [Quilt.configuration.react_server_host]) do
24
27
  proxy(headers, data)
25
28
  end
26
29
  else
@@ -37,9 +40,10 @@ module Quilt
37
40
  end
38
41
 
39
42
  begin
43
+ data_json = JSON.generate(data.as_json, ascii_only: true)
40
44
  reverse_proxy(
41
45
  url,
42
- headers: headers.merge('X-Request-ID': request.request_id, 'X-Quilt-Data': data.to_json)
46
+ headers: headers.merge('X-Request-ID': request.request_id, 'X-Quilt-Data': data_json)
43
47
  ) do |callbacks|
44
48
  callbacks.on_response do |status_code, _response|
45
49
  Quilt.logger.info("[ReactRenderable] #{url} returned #{status_code}")
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Quilt
3
- VERSION = "3.4.2"
3
+ VERSION = "3.5.4"
4
4
  end
data/lib/quilt_rails.rb CHANGED
@@ -2,6 +2,8 @@
2
2
  module Quilt
3
3
  end
4
4
 
5
+ require "statsd-instrument"
6
+
5
7
  require "quilt_rails/version"
6
8
  require "quilt_rails/logger"
7
9
  require "quilt_rails/configuration"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quilt_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.2
4
+ version: 3.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mathew Allen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-23 00:00:00.000000000 Z
11
+ date: 2021-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.0.3
160
+ rubygems_version: 3.2.20
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: A turn-key solution for integrating server-rendered React into your Rails