heroku-request-id 0.0.8 → 0.0.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bddaa4928013e2ba7ac9a3268104a76c4d008290
|
4
|
+
data.tar.gz: c28557afe1abc854473a128711e670d251307038
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73943012ca4416407e531f5d09bea0b1f96583a80bc2a96e370414e5ac9621c8113f3a01c496d58ba2b7043ae394922b4e4d97f0528e596dccafbddb9d7a1cc0
|
7
|
+
data.tar.gz: 3375678af04df501dcbd5a40a12b5ce56658c7ffaed825ba8f784929cbd841262bc8b3b10e282df25fb61db13b7b05de0f3d570113ce3f58cdb0640e72441e0d
|
@@ -55,7 +55,7 @@ module HerokuRequestId
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def build_msg
|
58
|
-
elapsed = @
|
58
|
+
elapsed = @headers['X-Runtime']
|
59
59
|
msg = %[Heroku request id : #{@request_id}]
|
60
60
|
if elapsed && elapsed.strip != ""
|
61
61
|
msg += %[ - Elapsed time (from Rack::Runtime) : #{elapsed}]
|
@@ -8,35 +8,39 @@ describe HerokuRequestId::Middleware do
|
|
8
8
|
lambda { |env| [200, {'Content-Type' => 'text/html'}, ['<body>All good!</body>']] }
|
9
9
|
end
|
10
10
|
|
11
|
+
let(:inner_app_with_rack_runtime) do
|
12
|
+
lambda { |env| [200, {'Content-Type' => 'text/html','X-Runtime' => '42'}, ['<body>All good!</body>']] }
|
13
|
+
end
|
14
|
+
|
11
15
|
let(:app) { HerokuRequestId::Middleware.new(inner_app) }
|
12
16
|
|
13
|
-
let(:
|
17
|
+
let(:request)do
|
14
18
|
capture_stdout{ get("/", {}, {"HTTP_HEROKU_REQUEST_ID" => "the_id_string"}) }
|
15
19
|
end
|
16
20
|
|
17
|
-
let(:request_with_rack_runtime)do
|
18
|
-
capture_stdout{ get("/", {}, {"HTTP_HEROKU_REQUEST_ID" => "the_id_string","X-Runtime" => "42"}) }
|
19
|
-
end
|
20
|
-
|
21
21
|
it "prints the request id to stdout by default" do
|
22
|
-
output =
|
22
|
+
output = request
|
23
23
|
output.should match("Heroku request id")
|
24
24
|
output.should match("the_id_string")
|
25
25
|
end
|
26
26
|
|
27
27
|
it "Does not include runtime information if the 'X-Runtime' header is not present" do
|
28
|
-
output =
|
28
|
+
output = request
|
29
29
|
output.should match("Runtime info not available")
|
30
30
|
end
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
describe "with Rack::Runtime" do
|
33
|
+
let(:app) { HerokuRequestId::Middleware.new(inner_app_with_rack_runtime) }
|
34
|
+
it "Does include runtime information if the 'X-Runtime' header is present" do
|
35
|
+
output = request
|
36
|
+
output.should match("Elapsed time")
|
37
|
+
end
|
35
38
|
end
|
39
|
+
|
36
40
|
|
37
41
|
it "does not print the request id to stdout if log_line == false" do
|
38
42
|
HerokuRequestId::Middleware.log_line = false
|
39
|
-
output =
|
43
|
+
output = request
|
40
44
|
output.should_not match("heroku-request-id")
|
41
45
|
output.should_not match("the_id_string")
|
42
46
|
# reset html_comment so that random test order works
|
@@ -44,14 +48,14 @@ describe HerokuRequestId::Middleware do
|
|
44
48
|
end
|
45
49
|
|
46
50
|
it "does not add a comment with the Heroku request id by default" do
|
47
|
-
|
51
|
+
request
|
48
52
|
last_response.body.should_not match("Heroku request id")
|
49
53
|
last_response.body.should_not match("the_id_string")
|
50
54
|
end
|
51
55
|
|
52
56
|
it "does add a comment with the Heroku request id if html_comment == true" do
|
53
57
|
HerokuRequestId::Middleware.html_comment = true
|
54
|
-
|
58
|
+
request
|
55
59
|
last_response.body.should match("Heroku request id")
|
56
60
|
last_response.body.should match("the_id_string")
|
57
61
|
# reset html_comment so that random test order works
|
@@ -59,7 +63,7 @@ describe HerokuRequestId::Middleware do
|
|
59
63
|
end
|
60
64
|
|
61
65
|
it "makes no change to response status" do
|
62
|
-
|
66
|
+
request
|
63
67
|
last_response.should be_ok
|
64
68
|
end
|
65
69
|
|