hubrise_initializer 0.2.4 → 0.2.5
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/hubrise_initializer/lograge.rb +9 -1
- data/lib/hubrise_initializer/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 382ed88d72aceb55e7cc9e65fc93be9415919c88759637252ba356e4c1d00721
|
4
|
+
data.tar.gz: fed70b073a0a56e416c38aa292fe94e53363f91fe50e4cab3f08c463a090f53e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63e0994eb3f19d066d133228a566972fe91edba3f6bad916e6d1172b40d8b72c7cdcceb9491cbb4361d81cbfea30c8f9dbe3b0e814846219a3a671f3e0a68a38
|
7
|
+
data.tar.gz: 3413d1ae4814d3a1ed6671e2688f5013e79706ab27e29e88c1d202b5d9485e5bd9cb5e5bdccc1c78df4b6def8342d03f597f29eee4845ad210e4d7358eb0c341
|
@@ -17,7 +17,7 @@ class HubriseInitializer
|
|
17
17
|
if ENV['RAILS_LOGRAGE_QUERY'] == 'true'
|
18
18
|
{
|
19
19
|
request_headers: process_request_headers(request).to_s,
|
20
|
-
request_body: truncate_body(request.raw_post.
|
20
|
+
request_body: truncate_body(switch_to_utf8(request.raw_post, "Binary (#{request.raw_post.size} bytes)")),
|
21
21
|
response_headers: response.headers.to_h.to_s,
|
22
22
|
response_body: truncate_body(response.body),
|
23
23
|
}
|
@@ -31,6 +31,14 @@ class HubriseInitializer
|
|
31
31
|
|
32
32
|
TRUNCATED_BODY_MAX_LENGTH = 1000
|
33
33
|
|
34
|
+
# Switch string encoding to utf-8. Return fallback if not a valid utf-8 sequence.
|
35
|
+
def switch_to_utf8(s, fallback)
|
36
|
+
s_utf_8 = s.dup.force_encoding(Encoding::UTF_8)
|
37
|
+
s_utf_8.valid_encoding? ?
|
38
|
+
s_utf_8 :
|
39
|
+
fallback
|
40
|
+
end
|
41
|
+
|
34
42
|
def truncate_body(s)
|
35
43
|
s.present? ? s.squish.truncate(TRUNCATED_BODY_MAX_LENGTH, omission: '...') : nil
|
36
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hubrise_initializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antoine Monnier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lograge
|
@@ -97,8 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
|
101
|
-
rubygems_version: 2.7.6
|
100
|
+
rubygems_version: 3.0.5
|
102
101
|
signing_key:
|
103
102
|
specification_version: 4
|
104
103
|
summary: Rails app initializers optimized for HubRise
|