protocol-http 0.26.2 → 0.26.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37ad7cebabada676314b89eb107ccd52dc5b4ca39ae06286189da63e48732020
4
- data.tar.gz: b6d949c575e5beebe00e2fd3b88be34ea3600380ebb65a88ef95f206cc615de6
3
+ metadata.gz: cd49532afd66aa61fc45281ce3fd9493e241790cd3daaf59c071793f91b5b42a
4
+ data.tar.gz: a8b0cefa5ad518293558a66a2db77fb4bd9ef3ba381134d9051d24ad1bcb64a5
5
5
  SHA512:
6
- metadata.gz: 6b934b6150bef7f73a113720dd2091f84605f424ac6daf9591828c28890ddacc0cfe3a143674e3d1f9b399b9ecf59b566e117b8a89fa5f7198a931456fd8314c
7
- data.tar.gz: 7e9cb8d0d7c1fa9fd39cb4adf1048cb88e284b8fb4513b27c8910ca5c7df4eabf277c2b1545ddc3da8054cacda2cb025c26944613a307900d4afb85dee836d3f
6
+ metadata.gz: 8d243e058e7cd0dd9825c44de883e5badf0df4aa150608ffdc034e4c0259412d64699cb97e0132e2d9307bcf874a2ce67f03e02046d00c761415d71c5c0a7941
7
+ data.tar.gz: 0d29c9fd133dede2b2d7a545405df8e64dcfb497477c1252bb34e41fffac7fc9540142b9d1961a146d2e4afcedc86fb4cb9ce2e75d55a5c1a5e4ac4c0ced8659
checksums.yaml.gz.sig CHANGED
Binary file
@@ -92,6 +92,16 @@ module Protocol
92
92
  return buffer
93
93
  end
94
94
  end
95
+
96
+ def as_json
97
+ {
98
+ class: self.class.name,
99
+ length: self.length,
100
+ stream: self.stream?,
101
+ ready: self.ready?,
102
+ empty: self.empty?
103
+ }
104
+ end
95
105
  end
96
106
  end
97
107
  end
@@ -51,6 +51,13 @@ module Protocol
51
51
  @body.read
52
52
  end
53
53
 
54
+ def as_json
55
+ {
56
+ class: self.class.name,
57
+ body: @body&.as_json
58
+ }
59
+ end
60
+
54
61
  def inspect
55
62
  @body.inspect
56
63
  end
@@ -299,6 +299,8 @@ module Protocol
299
299
  end
300
300
  end
301
301
 
302
+ alias as_json to_h
303
+
302
304
  def inspect
303
305
  "#<#{self.class} #{@fields.inspect}>"
304
306
  end
@@ -73,6 +73,19 @@ module Protocol
73
73
  @method != Methods::POST && (@body.nil? || @body.empty?)
74
74
  end
75
75
 
76
+ def as_json
77
+ {
78
+ scheme: @scheme,
79
+ authority: @authority,
80
+ method: @method,
81
+ path: @path,
82
+ version: @version,
83
+ headers: @headers&.as_json,
84
+ body: @body&.as_json,
85
+ protocol: @protocol
86
+ }
87
+ end
88
+
76
89
  def to_s
77
90
  "#{@scheme}://#{@authority}: #{@method} #{@path} #{@version}"
78
91
  end
@@ -104,6 +104,16 @@ module Protocol
104
104
  Response[500, Headers['content-type' => 'text/plain'], ["#{exception.class}: #{exception.message}"]]
105
105
  end
106
106
 
107
+ def as_json
108
+ {
109
+ version: @version,
110
+ status: @status,
111
+ headers: @headers&.as_json,
112
+ body: @body&.as_json,
113
+ protocol: @protocol
114
+ }
115
+ end
116
+
107
117
  def to_s
108
118
  "#{@status} #{@version}"
109
119
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module HTTP
8
- VERSION = "0.26.2"
8
+ VERSION = "0.26.3"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.2
4
+ version: 0.26.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -47,7 +47,7 @@ cert_chain:
47
47
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
48
48
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
49
49
  -----END CERTIFICATE-----
50
- date: 2024-04-09 00:00:00.000000000 Z
50
+ date: 2024-04-16 00:00:00.000000000 Z
51
51
  dependencies: []
52
52
  description:
53
53
  email:
metadata.gz.sig CHANGED
Binary file