timber 2.0.21 → 2.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/timber/util/request.rb +12 -5
- data/lib/timber/version.rb +1 -1
- data/spec/timber/util/request_spec.rb +10 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb727abf7308983fedd10e2b44e661ce337a5fed
|
4
|
+
data.tar.gz: 4dd342bfd405154dc7e2cc670789745c8879f01b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e781929108c46a6a4a6979ed4255bb57e2bb8ee86397f95b8da4a517e795778dd715347d993ab627eefe951a565d9890b91d2729c73717c8a8224ce125f2c2c
|
7
|
+
data.tar.gz: ac45f8c6b93f67b1829b0771e74b37968ea22e2f413e9bf4ac7952e0c2b292536ebd18f82b807a9721708ba5f20b15be50e85ca7710fa0d96d76287f87d4a7cf
|
data/lib/timber/util/request.rb
CHANGED
@@ -6,19 +6,26 @@ end
|
|
6
6
|
if defined?(::Rack::Request)
|
7
7
|
module Timber
|
8
8
|
module Util
|
9
|
+
# @private
|
9
10
|
class Request < ::Rack::Request
|
11
|
+
HTTP_PREFIX = 'HTTP_'.freeze
|
12
|
+
|
10
13
|
def body_content
|
11
14
|
content = body.read
|
12
15
|
body.rewind
|
13
16
|
content
|
14
17
|
end
|
15
18
|
|
19
|
+
# Returns a list of request headers. The rack env contains a lot of data, this function
|
20
|
+
# identifies those that were the actual request headers.
|
16
21
|
def headers
|
17
|
-
@headers ||= ::Hash[
|
18
|
-
.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
+
@headers ||= ::Hash[
|
23
|
+
*@env.select { |k,v| k.is_a?(String) && k.start_with?(HTTP_PREFIX) }
|
24
|
+
.collect { |k,v| [k.sub(/^#{HTTP_PREFIX}/, ''), v] }
|
25
|
+
.collect { |k,v| [k.split('_').collect(&:capitalize).join('-'), v] }
|
26
|
+
.sort
|
27
|
+
.flatten
|
28
|
+
]
|
22
29
|
end
|
23
30
|
|
24
31
|
def ip
|
data/lib/timber/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timber Technologies, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -243,6 +243,7 @@ files:
|
|
243
243
|
- spec/timber/log_entry_spec.rb
|
244
244
|
- spec/timber/logger_spec.rb
|
245
245
|
- spec/timber/util/http_event_spec.rb
|
246
|
+
- spec/timber/util/request_spec.rb
|
246
247
|
- timber.gemspec
|
247
248
|
homepage: https://github.com/timberio/timber-ruby
|
248
249
|
licenses: []
|
@@ -300,3 +301,4 @@ test_files:
|
|
300
301
|
- spec/timber/log_entry_spec.rb
|
301
302
|
- spec/timber/logger_spec.rb
|
302
303
|
- spec/timber/util/http_event_spec.rb
|
304
|
+
- spec/timber/util/request_spec.rb
|