Sha256: 8bea99c26023385dbc19ad82bd8ce12c7bc9813d15716cbe04a4c14960f00324
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
module Typhoeus module Responses # This module contains logic about informations # on a response. module Informations # All available informations. AVAILABLE_INFORMATIONS = Ethon::Easies::Informations::AVAILABLE_INFORMATIONS.keys+ [:return_code, :response_body, :response_header] AVAILABLE_INFORMATIONS.each do |name| define_method(name) do options[name.to_sym] end end # Returns the response header. # # @example Return header. # response.header # # @return [ Header ] The response header. def header return nil if response_header.nil? && @header.nil? @header ||= Responses::Header.new(response_header.split("\r\n\r\n").last) end # Return all redirections in between as multiple # responses with header. # # @example Return redirections. # response.redirections # # @return [ Array ] The redirections def redirections return [] unless response_header response_header.split("\r\n\r\n")[0..-2].map{ |h| Response.new(:response_header => h) } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
typhoeus-0.5.0.alpha | lib/typhoeus/responses/informations.rb |