marcopolo 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/marcopolo/middleware.rb +12 -8
- data/lib/marcopolo/version.rb +1 -1
- 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: 023e1afa09c72d23e1e982318941a980e5ad841c
|
4
|
+
data.tar.gz: 725b1084a09540fd9996882f9acb324624853fd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2070d60fafe9cb7165d0ae92589ffed6f82210045aa34dfe4ddddb0b61de6377e45a6873fc48928514f3909aaa1e8c27475f9067612c7cadb0ad4af68cd43d5d
|
7
|
+
data.tar.gz: 572614652abe7cef657c9d13e56c79f3b92fe1832656bfe582926ceab36f994bca9dbf87ce3d7e33c084a55f43f5c275b1eb7683de7b2c21273e949456829291
|
data/README.md
CHANGED
data/lib/marcopolo/middleware.rb
CHANGED
@@ -15,11 +15,11 @@ module Marcopolo
|
|
15
15
|
Marcopolo.log "Filtering request: #{@request.request_method} #{@request.url}"
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
status, headers, response = @app.call(env)
|
19
19
|
|
20
|
-
rawlog_response(
|
20
|
+
rawlog_response(status, headers, response) if allow
|
21
21
|
|
22
|
-
return [
|
22
|
+
return [status, headers, response]
|
23
23
|
end
|
24
24
|
|
25
25
|
def rawlog_request(env)
|
@@ -38,28 +38,32 @@ module Marcopolo
|
|
38
38
|
req_headers.to_a.each {|i| req_hash["\t" + i.first] = i.last }
|
39
39
|
|
40
40
|
req_hash.merge!({
|
41
|
-
"Request Body" => @request.body.
|
41
|
+
"Request Body" => @request.body.string
|
42
42
|
})
|
43
43
|
|
44
44
|
Marcopolo.log req_hash.to_a.map {|o| o.join(': ') }.join("\n") + "\n"
|
45
|
+
rescue => e
|
46
|
+
Marcopolo.log "Failed to log request: #{e}"
|
45
47
|
end
|
46
48
|
|
47
|
-
def rawlog_response(
|
49
|
+
def rawlog_response(status, headers, response)
|
48
50
|
resp_hash = {
|
49
51
|
"RESPONSE" => "",
|
50
|
-
"Response Status" =>
|
52
|
+
"Response Status" => status,
|
51
53
|
"Response Headers" => ""
|
52
54
|
}
|
53
55
|
|
54
|
-
|
56
|
+
headers.to_a.each {|i| resp_hash["\t" + i.first] = i.last }
|
55
57
|
|
56
|
-
response_body =
|
58
|
+
response_body = response.respond_to?(:body) ? response.body : response
|
57
59
|
|
58
60
|
resp_hash.merge!({
|
59
61
|
"Response Body" => response_body
|
60
62
|
})
|
61
63
|
|
62
64
|
Marcopolo.log resp_hash.to_a.map {|o| o.join(': ') }.join("\n") + "\n"
|
65
|
+
rescue => e
|
66
|
+
Marcopolo.log "Failed to log response: #{e}"
|
63
67
|
end
|
64
68
|
end
|
65
69
|
end
|
data/lib/marcopolo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marcopolo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Hammond
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|