class LHC::Response
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/lhc/response.rbs class LHC::Response def initialize: (Typhoeus::Response raw, LHC::Request request, from_cache: false) -> void end
and provides functionality to access response data.
The response contains the raw response (typhoeus)
def [](key)
def [](key) data[key] end
def body
def body body_replacement || raw.body.presence end
def data
def data @data ||= body.present? ? LHC::Response::Data.new(self) : nil end
def format
def format return LHC::Formats::JSON.new if request.nil? request.format end
def initialize(raw, request, from_cache: false)
Experimental RBS support (using type sampling data from the type_fusion
project).
def initialize: (Typhoeus::Response raw, LHC::Request request, from_cache: false) -> void
This signature was generated using 32 samples from 3 applications.
A response is initalized with the underlying raw response (typhoeus in our case)
def initialize(raw, request, from_cache: false) self.request = request self.raw = raw @from_cache = from_cache end
def scrubbed_options
def scrubbed_options scrubbed_options = options.deep_dup scrubbed_options[:effective_url] = LHC::EffectiveUrlScrubber.new(scrubbed_options[:effective_url]).scrubbed scrubbed_options end
def time
def time raw.time || 0 end
def time_ms
def time_ms time * 1000 end
def timeout?
def timeout? raw.timed_out? end