lib/protocol/http/response.rb in protocol-http-0.26.3 vs lib/protocol/http/response.rb in protocol-http-0.26.4
- old
+ new
@@ -102,17 +102,21 @@
def self.for_exception(exception)
Response[500, Headers['content-type' => 'text/plain'], ["#{exception.class}: #{exception.message}"]]
end
- def as_json
+ def as_json(...)
{
version: @version,
status: @status,
headers: @headers&.as_json,
body: @body&.as_json,
protocol: @protocol
}
+ end
+
+ def to_json(...)
+ as_json.to_json(...)
end
def to_s
"#{@status} #{@version}"
end