rack-instruments 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rack/instruments.rb +6 -0
- metadata +2 -2
data/lib/rack/instruments.rb
CHANGED
@@ -17,6 +17,7 @@ module Rack
|
|
17
17
|
@request_id_generator = options.fetch(:request_id_generator,
|
18
18
|
lambda { SecureRandom.uuid })
|
19
19
|
@request_id_pattern = options.fetch(:request_id_pattern, UUID_PATTERN)
|
20
|
+
@response_request_id = options.fetch(:response_request_id, false)
|
20
21
|
end
|
21
22
|
|
22
23
|
def call(env)
|
@@ -51,6 +52,11 @@ module Rack
|
|
51
52
|
status, headers, response = @app.call(env)
|
52
53
|
end
|
53
54
|
|
55
|
+
# optionally, inject a request ID into the reponse headers
|
56
|
+
if @response_request_id
|
57
|
+
headers["Request-Id"] = request_ids[0]
|
58
|
+
end
|
59
|
+
|
54
60
|
[status, headers, response]
|
55
61
|
end
|
56
62
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-instruments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: slides
|