Skip to content

Commit

Permalink
Fixing doubling up of URL in plain request logs
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjeffries committed Mar 19, 2018
1 parent 4af3b90 commit 812022d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.6.5

Bugfix:

- Plain requests were having the URL output to the log twice (thanks to Dan W for reporting this)

## 1.6.4

Feature:
Expand Down
1 change: 1 addition & 0 deletions lib/flexirest/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def self._lazy_request(request, method = :get, params = nil, options = {})
def self.prepare_direct_request(request, method = :get, options={})
unless request.is_a? Flexirest::Request
options[:plain] ||= false
options[:direct] ||= true
request = Flexirest::Request.new({ url: request, method: method, options: options }, self)
end
request
Expand Down
6 changes: 5 additions & 1 deletion lib/flexirest/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,11 @@ def do_request(etag)
base_url.gsub!(%r{//(.)}, "//#{username}:#{password}@\\1") if username && !base_url[%r{//[^/]*:[^/]*@}]
connection = Flexirest::ConnectionManager.get_connection(base_url)
end
Flexirest::Logger.info " \033[1;4;32m#{Flexirest.name}\033[0m #{@instrumentation_name} - Requesting #{connection.base_url}#{@url}"
if @method[:options][:direct]
Flexirest::Logger.info " \033[1;4;32m#{Flexirest.name}\033[0m #{@instrumentation_name} - Requesting #{@url}"
else
Flexirest::Logger.info " \033[1;4;32m#{Flexirest.name}\033[0m #{@instrumentation_name} - Requesting #{connection.base_url}#{@url}"
end

if verbose?
Flexirest::Logger.debug "Flexirest Verbose Log:"
Expand Down
2 changes: 1 addition & 1 deletion lib/flexirest/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Flexirest
VERSION = "1.6.4"
VERSION = "1.6.5"
end

0 comments on commit 812022d

Please sign in to comment.