lib/timber/util/http_event.rb in timber-2.1.1 vs lib/timber/util/http_event.rb in timber-2.1.2
- old
+ new
@@ -1,12 +1,11 @@
module Timber
module Util
- # Utility module for dealing with HTTP events {Events::HTTPServerRequest},
- # {Events::HTTPServerResponse}, {Events::HTTPClientRequest}, {Events::HTTPClientResponse}.
+ # Utility module for dealing with HTTP events {Events::HTTPRequest} and {Events::HTTPResponse}.
module HTTPEvent
HEADERS_TO_SANITIZE = ['authorization', 'x-amz-security-token'].freeze
- QUERY_STRING_LIMIT = 5_000.freeze
+ MAX_QUERY_STRING_BYTES = 2048.freeze
STRING_CLASS_NAME = 'String'.freeze
extend self
def full_path(path, query_string)
@@ -23,11 +22,11 @@
body = body.body.to_s
end
limit = Config.instance.http_body_limit
if limit
- body[0..(limit - 1)]
+ body.byteslice(0, limit)
else
body
end
end
@@ -61,10 +60,10 @@
def normalize_query_string(query_string)
if !query_string.nil?
query_string = query_string.to_s
end
- query_string && query_string[0..(QUERY_STRING_LIMIT - 1)]
+ query_string && query_string.byteslice(0, MAX_QUERY_STRING_BYTES)
end
end
end
end
\ No newline at end of file