message_bus 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of message_bus might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f26f77d34d537d666747db10d116e2620239f35
4
- data.tar.gz: 1af42d9201dea09f8f533709cad6d4cf3afb7707
3
+ metadata.gz: ea4f0356599eb2162116ae4f248a3cef4fa01273
4
+ data.tar.gz: af4ca7315e84cd65d5ec9116a1aa61b6f3c69b85
5
5
  SHA512:
6
- metadata.gz: 2880b09a9223afbfa3d4ae0b9cfad08ddf9dec05d3f5058930019bf7fefbdaaad3d22b4803dd50ad6fff2a70a736794cfa99f66cfab061adbba3ccbdaedc2892
7
- data.tar.gz: 974187d731c56cb02a8c56297737f38d4cbb72b588598d9ad4f9ef19fc65a0955867f0545fc6b160bc3bf0a30ce6155643ec7b46d7b3a7873f8a4ffbf427f808
6
+ metadata.gz: 94b77a368cc509c56978ae656d171309a0b448fc42e0976b961483a022fa9953965b0a64fa8e9e28d1b5af46f8a31a9c4cc8f7fb04b42477e5608341e23a53cf
7
+ data.tar.gz: 61b01a3d60b13b2853c13f454e24046118fe131291896bbb0b9ff9f181ae2a2c481abdbd184640bbc91f65f51951cd0257e5bbaf4f0715f8703292b4d28b7e1c
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 23-09-2014
2
+ - Version 1.0.4
3
+ - Change: MessageBus.access_control_allow_origin_lookup to extra_response_headers_lookup
4
+
1
5
  23-09-2014
2
6
  - Version 1.0.3
3
7
  - Change: MessageBus.access_control_allow_origin to MessageBus.access_control_allow_origin_lookup
data/lib/message_bus.rb CHANGED
@@ -141,9 +141,9 @@ module MessageBus::Implementation
141
141
  @is_admin_lookup
142
142
  end
143
143
 
144
- def access_control_allow_origin_lookup(&blk)
145
- @access_control_allow_origin_lookup = blk if blk
146
- @access_control_allow_origin_lookup
144
+ def extra_response_headers_lookup(&blk)
145
+ @extra_response_headers_lookup = blk if blk
146
+ @extra_response_headers_lookup
147
147
  end
148
148
 
149
149
  def client_filter(channel, &blk)
@@ -87,7 +87,15 @@ class MessageBus::Rack::Middleware
87
87
  headers = {}
88
88
  headers["Cache-Control"] = "must-revalidate, private, max-age=0"
89
89
  headers["Content-Type"] ="application/json; charset=utf-8"
90
- headers["Access-Control-Allow-Origin"] = @bus.access_control_allow_origin_lookup.call(env) if @bus.access_control_allow_origin_lookup
90
+ if @bus.extra_response_headers_lookup
91
+ @bus.extra_response_headers_lookup.call(env).each do |k,v|
92
+ headers[k] = v
93
+ end
94
+ end
95
+
96
+ if env["REQUEST_METHOD"] == "OPTIONS"
97
+ return [200, headers, ["OK"]]
98
+ end
91
99
 
92
100
  ensure_reactor
93
101
 
@@ -1,3 +1,3 @@
1
1
  module MessageBus
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -163,8 +163,8 @@ describe MessageBus::Rack::Middleware do
163
163
  end
164
164
 
165
165
  it "should include access control headers" do
166
- @bus.access_control_allow_origin_lookup do |env|
167
- "http://rainbows.com"
166
+ @bus.extra_response_headers_lookup do |env|
167
+ {"FOO" => "BAR"}
168
168
  end
169
169
 
170
170
  client_id = "ABCD"
@@ -175,7 +175,7 @@ describe MessageBus::Rack::Middleware do
175
175
  '/bar' => nil
176
176
  }
177
177
 
178
- last_response.headers["Access-Control-Allow-Origin"].should == "http://rainbows.com"
178
+ last_response.headers["FOO"].should == "BAR"
179
179
  end
180
180
 
181
181
  it "should respond with a 200 to a subscribe" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: message_bus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron