timber 2.0.23 → 2.0.24
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.
- checksums.yaml +4 -4
- data/lib/timber/util/http_event.rb +17 -2
- data/lib/timber/util/string.rb +1 -1
- data/lib/timber/version.rb +1 -1
- data/spec/timber/util/http_event_spec.rb +5 -0
- 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: 8c631daf0393857de501da9e12c1087f4f6cceda
|
4
|
+
data.tar.gz: 55b336aec1471657a0358d80e7bfabdd1c6a7a1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 706a67aec83bf76c5a2089c3d7ca14b15226a05fd3113a4896cc0faec27ba7976c439783e7a3f50367ec38e7cbacf9c7611a8e493a4faadfcdc3356610df5634
|
7
|
+
data.tar.gz: c4e70b7199e075ce052593fe0a4d9c12cb83e2ecd0599fbb3188f939d6b234517e07f50d32f7c0daaf0f5a92a635b355830560044d7407de45e57fdf9511bd56
|
@@ -3,6 +3,7 @@ module Timber
|
|
3
3
|
module HTTPEvent
|
4
4
|
AUTHORIZATION_HEADER = 'authorization'.freeze
|
5
5
|
QUERY_STRING_LIMIT = 5_000.freeze
|
6
|
+
STRING_CLASS_NAME = 'String'.freeze
|
6
7
|
|
7
8
|
extend self
|
8
9
|
|
@@ -26,9 +27,23 @@ module Timber
|
|
26
27
|
if headers.is_a?(::Hash)
|
27
28
|
h = headers.each_with_object({}) do |(k, v), h|
|
28
29
|
# Force the header into a valid UTF-8 string, otherwise we will encounter
|
29
|
-
# encoding issues when we
|
30
|
+
# encoding issues when we serialize this data. Moreoever, if the
|
30
31
|
# data is already valid UTF-8 we don't pay a penalty.
|
31
|
-
|
32
|
+
#
|
33
|
+
# Note: we compare the class name because...
|
34
|
+
#
|
35
|
+
# string = 'my string'.force_encoding('ASCII-8BIT')
|
36
|
+
# string.is_a?(String) => false
|
37
|
+
# string.class => String
|
38
|
+
# string.class == String => false
|
39
|
+
# string.class.name == "String" => true
|
40
|
+
#
|
41
|
+
# ¯\_(ツ)_/¯
|
42
|
+
if v.class.name == STRING_CLASS_NAME
|
43
|
+
h[k] = Timber::Util::String.normalize_to_utf8(v)
|
44
|
+
else
|
45
|
+
h[k] = v
|
46
|
+
end
|
32
47
|
end
|
33
48
|
|
34
49
|
keys_to_sanitize = [AUTHORIZATION_HEADER] + (Config.instance.header_filters || [])
|
data/lib/timber/util/string.rb
CHANGED
data/lib/timber/version.rb
CHANGED
@@ -6,5 +6,10 @@ describe Timber::Util::HTTPEvent, :rails_23 => true do
|
|
6
6
|
result = described_class.normalize_headers({"key" => nil})
|
7
7
|
expect(result).to eq({"key" => nil})
|
8
8
|
end
|
9
|
+
|
10
|
+
it "should handle non strings" do
|
11
|
+
result = described_class.normalize_headers({"key" => 1})
|
12
|
+
expect(result).to eq({"key" => 1})
|
13
|
+
end
|
9
14
|
end
|
10
15
|
end
|
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.24
|
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-
|
11
|
+
date: 2017-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|