File tree Expand file tree Collapse file tree 4 files changed +22
-3
lines changed
Expand file tree Collapse file tree 4 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 1+ require "logtail-rack/util/encoding"
2+
13module Logtail
24 module Integrations
35 module Rack
@@ -24,7 +26,7 @@ def initialize(attributes)
2426 @service_name = attributes [ :service_name ]
2527
2628 if @headers
27- @headers_json = @headers . to_json
29+ @headers_json = Util :: Encoding . force_utf8_encoding ( @headers ) . to_json
2830 end
2931 end
3032
Original file line number Diff line number Diff line change 1+ require "logtail-rack/util/encoding"
2+
13module Logtail
24 module Integrations
35 module Rack
@@ -19,7 +21,7 @@ def initialize(attributes)
1921 @duration_ms = attributes [ :duration_ms ]
2022
2123 if @headers
22- @headers_json = @headers . to_json
24+ @headers_json = Util :: Encoding . force_utf8_encoding ( @headers ) . to_json
2325 end
2426 end
2527
Original file line number Diff line number Diff line change 1+ module Logtail
2+ module Util
3+ class Encoding
4+ def self . force_utf8_encoding ( data )
5+ if data . respond_to? ( :force_encoding )
6+ data . dup . force_encoding ( 'UTF-8' )
7+ elsif data . respond_to? ( :transform_values )
8+ data . transform_values { |val | Logtail ::Util ::Encoding . force_utf8_encoding ( val ) }
9+ else
10+ data
11+ end
12+ end
13+ end
14+ end
15+ end
Original file line number Diff line number Diff line change 11module Logtail
22 module Integrations
33 module Rack
4- VERSION = "0.1.4 "
4+ VERSION = "0.1.5 "
55 end
66 end
77end
You can’t perform that action at this time.
0 commit comments