message_bus 1.0.1 → 1.0.2
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 +4 -4
- data/CHANGELOG +4 -0
- data/lib/message_bus/rack/middleware.rb +4 -2
- data/lib/message_bus/version.rb +1 -1
- data/lib/message_bus.rb +8 -0
- data/spec/lib/middleware_spec.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e700c3c80050d48c9178c002eff99ffc42e93ea
|
4
|
+
data.tar.gz: 1397d55bf69953ac861e8dc36bc217958daeab20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dac0e42ad4de5e15c56b8906c98cf55448bffbc5e5ea15615cbbb0c37d231cf423b79fab5130717e94900aa0777924ed8277db7a5b14dfc2e55ca581069d60a8
|
7
|
+
data.tar.gz: 1688685a11b6f70b027064ad97ea2a220a97ca424d1294fe379ef75a009793e7a7079c7e217a22ea9853ecfa7c4832e0f8f24a632d858db87380558ce39f241b
|
data/CHANGELOG
CHANGED
@@ -87,6 +87,7 @@ 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 if @bus.access_control_allow_origin
|
90
91
|
|
91
92
|
ensure_reactor
|
92
93
|
|
@@ -113,8 +114,9 @@ class MessageBus::Rack::Middleware
|
|
113
114
|
response = Thin::AsyncResponse.new(env)
|
114
115
|
end
|
115
116
|
|
116
|
-
|
117
|
-
|
117
|
+
headers.each do |k,v|
|
118
|
+
response.headers[k] = v
|
119
|
+
end
|
118
120
|
response.status = 200
|
119
121
|
|
120
122
|
client.async_response = response
|
data/lib/message_bus/version.rb
CHANGED
data/lib/message_bus.rb
CHANGED
@@ -141,6 +141,14 @@ module MessageBus::Implementation
|
|
141
141
|
@is_admin_lookup
|
142
142
|
end
|
143
143
|
|
144
|
+
def access_control_allow_origin=(origin)
|
145
|
+
@access_control_allow_origin = origin
|
146
|
+
end
|
147
|
+
|
148
|
+
def access_control_allow_origin
|
149
|
+
@access_control_allow_origin
|
150
|
+
end
|
151
|
+
|
144
152
|
def client_filter(channel, &blk)
|
145
153
|
@client_filters ||= {}
|
146
154
|
@client_filters[channel] = blk if blk
|
data/spec/lib/middleware_spec.rb
CHANGED
@@ -162,6 +162,20 @@ describe MessageBus::Rack::Middleware do
|
|
162
162
|
@bus.long_polling_enabled = false
|
163
163
|
end
|
164
164
|
|
165
|
+
it "should include access control headers" do
|
166
|
+
@bus.access_control_allow_origin = "http://rainbows.com"
|
167
|
+
|
168
|
+
client_id = "ABCD"
|
169
|
+
|
170
|
+
# client always keeps a list of channels with last message id they got on each
|
171
|
+
post "/message-bus/#{client_id}", {
|
172
|
+
'/foo' => nil,
|
173
|
+
'/bar' => nil
|
174
|
+
}
|
175
|
+
|
176
|
+
last_response.headers["Access-Control-Allow-Origin"].should == "http://rainbows.com"
|
177
|
+
end
|
178
|
+
|
165
179
|
it "should respond with a 200 to a subscribe" do
|
166
180
|
client_id = "ABCD"
|
167
181
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: message_bus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|