http_debug_output-parser 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/http_debug_output/parser/version.rb +1 -1
- data/lib/http_debug_output/parser.rb +6 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ca64ebb1c13e162e889a0d93e2b04bc3f2b363244599b9b35abf7d7130d1661
|
4
|
+
data.tar.gz: f4fe194df36fe913ef28e691fa62ff336e84bcdd85e0887e8ceed26ac3637290
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6eebe21ee196d94f96893ed8448f838688f601a260fcbd7aef1142400659829403e7b10d85487c564b04804b433a99bd83f4ee9f75576472d357bb05b58694e
|
7
|
+
data.tar.gz: b48684cc04a33dd6c31c9aefe0bb4c03e91432e930f88e06ab13410cd84cd852f412b90c5c84750f1500de8a7656f2e748fd639dfa41f702e5359135e706ce07
|
@@ -19,7 +19,7 @@ module HttpDebugOutput
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def parse_request # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
22
|
-
request_lines = @debug_output[find_range_for_start_and_end_strings('<- ', '-> ')]
|
22
|
+
request_lines = @debug_output[find_range_for_start_and_end_strings('<- ', '-> ', last_occurence_of_end: false)]
|
23
23
|
.map { |line| clean_line(line.gsub('<- ', '')) }
|
24
24
|
method, path, protocol = request_lines.first.split
|
25
25
|
headers = request_lines[1..].take_while { |line| line != '' }
|
@@ -40,7 +40,8 @@ module HttpDebugOutput
|
|
40
40
|
.filter { |line| line != '' }
|
41
41
|
protocol, status, *message = response_lines.first.split
|
42
42
|
headers = response_lines[1..].take_while { |line| !line.start_with?('reading') }
|
43
|
-
|
43
|
+
payload_end_index = response_lines.rindex { |line| line.start_with?('read ') } || response_lines.count
|
44
|
+
payload = response_lines[headers.count + 2..payload_end_index - 1].join
|
44
45
|
|
45
46
|
{
|
46
47
|
protocol:,
|
@@ -51,9 +52,10 @@ module HttpDebugOutput
|
|
51
52
|
}
|
52
53
|
end
|
53
54
|
|
54
|
-
def find_range_for_start_and_end_strings(start_index_string, end_index_string)
|
55
|
+
def find_range_for_start_and_end_strings(start_index_string, end_index_string, last_occurence_of_end: true)
|
55
56
|
start_index = @debug_output.find_index { |line| line.start_with?(start_index_string) }
|
56
|
-
|
57
|
+
end_index_method = last_occurence_of_end ? :rindex : :find_index
|
58
|
+
end_index = @debug_output.public_send(end_index_method) { |line| line.start_with?(end_index_string) }
|
57
59
|
start_index..end_index - 1
|
58
60
|
end
|
59
61
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http_debug_output-parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damian Baćkowski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-02-
|
11
|
+
date: 2025-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A gem that parses debug output from Ruby's Net::HTTP.
|
14
14
|
email:
|