wovnrb 0.2.29 → 0.2.30

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
  SHA1:
3
- metadata.gz: f15715b5f8a8d0d3bb58c2d8a86a915353d9cb7c
4
- data.tar.gz: 0bb121940678dbc50aa0beb7f9b5839f35935844
3
+ metadata.gz: 281a617c58ff1f8bd8c980da4118584c1aeb450d
4
+ data.tar.gz: 460e1c111d39d228c7414c79397397376f1e7211
5
5
  SHA512:
6
- metadata.gz: c51823510261c6a2d97ec201285f9eda6f51927e883f017815b48ddaf5c989b7776f670bc4c23599bbdfa5be2a46d33b60e72717d274072725898965b5062645
7
- data.tar.gz: 01e7f5d664b053574da8a78a86c363ad23556f4e7e443ffc05998ffb2ae1fc7feea1f706cb8b376920522aaff9b44085a08316757e1c2ff41510a0295c9cd958
6
+ metadata.gz: f5d08a461de2b6ee699270bd8e2abb65260f234b5f9235ea9d562507d1c27b4219ce5fbcb7a6cac18aa0f6de28598d26561e656a4f2d57dcc885cb2ba1fe79c9
7
+ data.tar.gz: e58d4bf0d44a99db8a66940bf7d025ca7ea8f6f8606e3e157356e34183c5f9e03952eb874a22179fd19b9dd59c43ef79139c7934d511d4aec4dd2c60e9ff3e76
data/lib/wovnrb.rb CHANGED
@@ -47,27 +47,31 @@ module Wovnrb
47
47
  status, res_headers, body = @app.call(headers.request_out)
48
48
 
49
49
  if res_headers["Content-Type"] =~ /html/
50
- unless @store.settings['ignore_globs'].any?{|g| g.match?(headers.pathname)}
51
- # If the user defines a token for this request, use it instead of the config token
52
- request = Rack::Request.new(env)
53
- if @store.valid_token?(request.params['wovn_token'])
54
- @store.settings['project_token'] = request.params['wovn_token']
50
+
51
+ request = Rack::Request.new(env)
52
+ unless request.params['wovn_disable'] == true
53
+ unless @store.settings['ignore_globs'].any?{|g| g.match?(headers.pathname)}
54
+ # If the user defines a token for this request, use it instead of the config token
55
+ if @store.valid_token?(request.params['wovn_token'])
56
+ @store.settings['project_token'] = request.params['wovn_token']
57
+ end
58
+ # ApiData creates request for external server, but cannot use async.
59
+ # Because some server not allow multi thread. (env['async.callback'] is not supported at all Server).
60
+ api_data = ApiData.new(headers.redis_url, @store)
61
+ values = api_data.get_data
62
+ url = {
63
+ :protocol => headers.protocol,
64
+ :host => headers.host,
65
+ :pathname => headers.pathname
66
+ }
67
+ body = switch_lang(body, values, url, lang, headers) unless status.to_s =~ /^1|302/
68
+
69
+ content_length = 0
70
+ body.each { |b| content_length += b.respond_to?(:bytesize) ? b.bytesize : 0 }
71
+ res_headers["Content-Length"] = content_length.to_s
55
72
  end
56
- # ApiData creates request for external server, but cannot use async.
57
- # Because some server not allow multi thread. (env['async.callback'] is not supported at all Server).
58
- api_data = ApiData.new(headers.redis_url, @store)
59
- values = api_data.get_data
60
- url = {
61
- :protocol => headers.protocol,
62
- :host => headers.host,
63
- :pathname => headers.pathname
64
- }
65
- body = switch_lang(body, values, url, lang, headers) unless status.to_s =~ /^1|302/
66
-
67
- content_length = 0
68
- body.each { |b| content_length += b.respond_to?(:bytesize) ? b.bytesize : 0 }
69
- res_headers["Content-Length"] = content_length.to_s
70
73
  end
74
+
71
75
  end
72
76
 
73
77
  headers.out(res_headers)
@@ -1,3 +1,3 @@
1
1
  module Wovnrb
2
- VERSION = "0.2.29"
2
+ VERSION = "0.2.30"
3
3
  end
@@ -81,6 +81,20 @@ class WovnrbTest < Minitest::Test
81
81
  assert_requested(stub, :times => 1)
82
82
  end
83
83
 
84
+ def test_request_wovn_disable
85
+ settings = Wovnrb.get_settings
86
+ token = settings['project_token']
87
+ url = 'wovn.io/dashboard'
88
+ stub = stub_request(:get, "#{settings['api_url']}?token=#{token}&url=#{url}").
89
+ to_return(:body => '{"test_body": "a"}')
90
+
91
+ i = Wovnrb::Interceptor.new(get_app(:params => {'wovn_disable' => true}), settings)
92
+
93
+ env = Wovnrb.get_env
94
+ i.call(env)
95
+ assert_requested(stub, :times => 0)
96
+ end
97
+
84
98
  def test_switch_lang
85
99
  i = Wovnrb::Interceptor.new(get_app)
86
100
  h = Wovnrb::Headers.new(Wovnrb.get_env('url' => 'http://page.com'), Wovnrb.get_settings('url_pattern' => 'subdomain', 'url_pattern_reg' => '^(?<lang>[^.]+).'))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wovnrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.29
4
+ version: 0.2.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Sandford
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-12-25 00:00:00.000000000 Z
12
+ date: 2018-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogumbo
@@ -423,4 +423,3 @@ test_files:
423
423
  - test/lib/wovnrb_test.rb
424
424
  - test/services/url_test.rb
425
425
  - test/test_helper.rb
426
- has_rdoc: