From f1df64123efad731a1af6c6764b6e93ce631919f Mon Sep 17 00:00:00 2001 From: Gonzalo Bulnes Guilpain Date: Mon, 6 Oct 2014 10:49:52 -0300 Subject: [PATCH 1/4] Fix remove circular require See the warning issued by HTTPI v2.2.5 in its context: https://travis-ci.org/the4dpatrick/possible-email/jobs/32727448 The warning was also issued by HTTPI v2.2.7. --- lib/httpi/adapter/base.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/httpi/adapter/base.rb b/lib/httpi/adapter/base.rb index 2f8a8e9..53796f9 100644 --- a/lib/httpi/adapter/base.rb +++ b/lib/httpi/adapter/base.rb @@ -1,4 +1,3 @@ -require "httpi" require "httpi/adapter" module HTTPI From d5eb03095d80406bc90f6b73c2ac3da79ef41495 Mon Sep 17 00:00:00 2001 From: Gonzalo Bulnes Guilpain Date: Mon, 6 Oct 2014 10:58:31 -0300 Subject: [PATCH 2/4] Minor fix ambiguous syntax Both files did issue "`*' interpreted as argument prefix" warnings in HTTPI 2.2.7. --- lib/httpi/adapter/net_http.rb | 2 +- lib/httpi/request.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/httpi/adapter/net_http.rb b/lib/httpi/adapter/net_http.rb index 03d52b8..e7a0f18 100644 --- a/lib/httpi/adapter/net_http.rb +++ b/lib/httpi/adapter/net_http.rb @@ -170,7 +170,7 @@ def request_client(type) end request_client = request_class.new @request.url.request_uri, @request.headers - request_client.basic_auth *@request.auth.credentials if @request.auth.basic? + request_client.basic_auth(*@request.auth.credentials) if @request.auth.basic? if @request.auth.digest? raise NotSupportedError, "Net::HTTP does not support HTTP digest authentication" diff --git a/lib/httpi/request.rb b/lib/httpi/request.rb index 3b3edac..3a8a3b4 100644 --- a/lib/httpi/request.rb +++ b/lib/httpi/request.rb @@ -82,9 +82,9 @@ def gzip # or an Array of `HTTPI::Cookie` objects. def set_cookies(object_or_array) if object_or_array.respond_to?(:cookies) - cookie_store.add *object_or_array.cookies + cookie_store.add(*object_or_array.cookies) else - cookie_store.add *object_or_array + cookie_store.add(*object_or_array) end cookies = cookie_store.fetch From 5bd2010ba5e26a4ada264dbfe678fdc1e17bb1a2 Mon Sep 17 00:00:00 2001 From: Gonzalo Bulnes Guilpain Date: Mon, 6 Oct 2014 11:48:27 -0300 Subject: [PATCH 3/4] Minor fix method redefinition HTTPI::Response#attachments was defined twice, which caused a warning to be issued by HTTI 2.2.7. --- lib/httpi/response.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/httpi/response.rb b/lib/httpi/response.rb index 72c3153..c710820 100644 --- a/lib/httpi/response.rb +++ b/lib/httpi/response.rb @@ -24,7 +24,8 @@ def initialize(code, headers, body) self.raw_body = body end - attr_accessor :code, :headers, :raw_body, :attachments + attr_accessor :code, :headers, :raw_body + attr_writer :attachments # Returns whether the HTTP response is considered successful. def error? From b1ea8559c0f6622fef250eb4f4f6da57984fc123 Mon Sep 17 00:00:00 2001 From: Gonzalo Bulnes Guilpain Date: Mon, 6 Oct 2014 11:52:06 -0300 Subject: [PATCH 4/4] Minor fix assigned but unused variables Both assignments caused a warning to be issed by HTTPI 2.2.7. --- lib/httpi.rb | 2 +- lib/httpi/adapter/curb.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/httpi.rb b/lib/httpi.rb index 29752c4..5a96b07 100644 --- a/lib/httpi.rb +++ b/lib/httpi.rb @@ -109,7 +109,7 @@ def query_builder=(builder) builder_name = builder.to_s.capitalize begin builder = HTTPI::QueryBuilder.const_get(builder_name) - rescue NameError => ex + rescue NameError raise ArgumentError, "Invalid builder. Available builders are: [:flat, :nested]" end end diff --git a/lib/httpi/adapter/curb.rb b/lib/httpi/adapter/curb.rb index d3fb253..4aea830 100644 --- a/lib/httpi/adapter/curb.rb +++ b/lib/httpi/adapter/curb.rb @@ -118,7 +118,7 @@ def setup_ssl_auth end def respond_with(client) - status, headers = parse_header_string(client.header_str) + headers = parse_header_string(client.header_str).last Response.new client.response_code, headers, client.body_str end