message_bus 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.rb +3 -3
- data/lib/message_bus/rack/middleware.rb +9 -1
- data/lib/message_bus/version.rb +1 -1
- data/spec/lib/middleware_spec.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea4f0356599eb2162116ae4f248a3cef4fa01273
|
4
|
+
data.tar.gz: af4ca7315e84cd65d5ec9116a1aa61b6f3c69b85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94b77a368cc509c56978ae656d171309a0b448fc42e0976b961483a022fa9953965b0a64fa8e9e28d1b5af46f8a31a9c4cc8f7fb04b42477e5608341e23a53cf
|
7
|
+
data.tar.gz: 61b01a3d60b13b2853c13f454e24046118fe131291896bbb0b9ff9f181ae2a2c481abdbd184640bbc91f65f51951cd0257e5bbaf4f0715f8703292b4d28b7e1c
|
data/CHANGELOG
CHANGED
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
|
145
|
-
@
|
146
|
-
@
|
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
|
-
|
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
|
|
data/lib/message_bus/version.rb
CHANGED
data/spec/lib/middleware_spec.rb
CHANGED
@@ -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.
|
167
|
-
"
|
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["
|
178
|
+
last_response.headers["FOO"].should == "BAR"
|
179
179
|
end
|
180
180
|
|
181
181
|
it "should respond with a 200 to a subscribe" do
|