lib/knj/http2.rb in knjrbfw-0.0.28 vs lib/knj/http2.rb in knjrbfw-0.0.29
- old
+ new
@@ -1,9 +1,9 @@
require "#{$knjpath}web"
class Knj::Http2
- attr_reader :cookies
+ attr_reader :cookies, :args
def initialize(args = {})
args = {:host => args} if args.is_a?(String)
raise "Arguments wasnt a hash." if !args.is_a?(Hash)
@@ -360,10 +360,10 @@
#Release variables.
resp = @resp
@resp = nil
@mode = nil
- raise "No status-code was received from the server.\n\nHeaders:\n#{Knj::Php.print_r(resp.headers)}\n\nBody:\n#{resp.args[:body]}" if !resp.args[:code]
+ raise "No status-code was received from the server.\n\nHeaders:\n#{Knj::Php.print_r(resp.headers, true)}\n\nBody:\n#{resp.args[:body]}" if !resp.args[:code]
if resp.args[:code].to_s == "302" and resp.header?("location") and (!@args.key?(:follow_redirects) or @args[:follow_redirects])
uri = URI.parse(resp.header("location"))
args = {:host => uri.host}
\ No newline at end of file