akita-har_logger 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/akita/har_logger/har_utils.rb +2 -2
- data/lib/akita/har_logger/http_response.rb +8 -6
- data/lib/akita/har_logger/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51fcd2da35cb17ecb365988d7975f746a717f12b002d3a20f1d0c3eab245b10c
|
4
|
+
data.tar.gz: 4972d841dfc7c8dcd41085137d45faedeb450836d46e6d3f14d584785d997a24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fdffa25d122a573e8c72526934e5e713fbdc573c0d4ebfa13383d749ea856f9b01d2e5bc43e89b1c152df64f97cd965ad54bd5a4ebab924d222a1829bbbec60
|
7
|
+
data.tar.gz: 8ca06a98ce89ec4e9c3e6ac7f3b10ec98f73c44aacab1af0bac8c81649f342ec721017ee57ff6590c93a24234cce9d40c9b341aa8277a39a59bc86a3a9c3484e
|
data/Gemfile.lock
CHANGED
@@ -4,9 +4,9 @@ module Akita
|
|
4
4
|
module HarLogger
|
5
5
|
class HarUtils
|
6
6
|
# Rack apparently uses 8-bit ASCII for everything, even when the string
|
7
|
-
# is not 8-bit ASCII. This reinterprets
|
7
|
+
# is not 8-bit ASCII. This reinterprets 8-bit ASCII strings as UTF-8.
|
8
8
|
def self.fixEncoding(v)
|
9
|
-
if v == nil || v.encoding
|
9
|
+
if v == nil || v.encoding != Encoding::ASCII_8BIT then
|
10
10
|
v
|
11
11
|
else
|
12
12
|
String.new(v).force_encoding(Encoding::UTF_8)
|
@@ -25,7 +25,7 @@ module Akita
|
|
25
25
|
|
26
26
|
# Obtains the status text corresponding to a status code.
|
27
27
|
def getStatusText(status)
|
28
|
-
Rack::Utils::HTTP_STATUS_CODES[status]
|
28
|
+
HarUtils.fixEncoding(Rack::Utils::HTTP_STATUS_CODES[status])
|
29
29
|
end
|
30
30
|
|
31
31
|
# Obtains the HTTP version in the response.
|
@@ -65,8 +65,8 @@ module Akita
|
|
65
65
|
if match then cookie_value = match[1] end
|
66
66
|
|
67
67
|
result << {
|
68
|
-
name: cookie_name,
|
69
|
-
value: cookie_value,
|
68
|
+
name: HarUtils.fixEncoding(cookie_name),
|
69
|
+
value: HarUtils.fixEncoding(cookie_value),
|
70
70
|
}
|
71
71
|
}
|
72
72
|
|
@@ -79,14 +79,14 @@ module Akita
|
|
79
79
|
text = +""
|
80
80
|
body.each { |part|
|
81
81
|
# XXX Figure out how to join together multi-part bodies.
|
82
|
-
text << part;
|
82
|
+
text << (HarUtils.fixEncoding part);
|
83
83
|
}
|
84
84
|
|
85
85
|
{
|
86
86
|
size: getBodySize(body),
|
87
87
|
|
88
88
|
# XXX What to use when no Content-Type is given?
|
89
|
-
mimeType: headers['Content-Type'],
|
89
|
+
mimeType: HarUtils.fixEncoding(headers['Content-Type']),
|
90
90
|
|
91
91
|
text: text,
|
92
92
|
}
|
@@ -95,7 +95,9 @@ module Akita
|
|
95
95
|
def getRedirectUrl(headers)
|
96
96
|
# Use the "Location" header if it exists. Otherwise, based on some HAR
|
97
97
|
# examples found online, it looks like an empty string is used.
|
98
|
-
headers.key?('Location') ?
|
98
|
+
headers.key?('Location') ?
|
99
|
+
HarUtils.fixEncoding(headers['Location']) :
|
100
|
+
''
|
99
101
|
end
|
100
102
|
|
101
103
|
def getHeadersSize(env, status, headers)
|