lib/flexirest/request.rb in flexirest-1.2.19 vs lib/flexirest/request.rb in flexirest-1.3.1

- old
+ new

@@ -141,11 +141,11 @@ prepare_url if fake = @method[:options][:fake] if fake.respond_to?(:call) fake = fake.call(self) end - Flexirest::Logger.debug " \033[1;4;32m#{Flexirest::NAME}\033[0m #{@instrumentation_name} - Faked response found" + Flexirest::Logger.debug " \033[1;4;32m#{Flexirest.name}\033[0m #{@instrumentation_name} - Faked response found" content_type = @method[:options][:fake_content_type] || "application/json" return handle_response(OpenStruct.new(status:200, body:fake, response_headers:{"X-ARC-Faked-Response" => "true", "Content-Type" => content_type})) end if object_is_class? @object.send(:_filter_request, :before, @method[:name], self) @@ -156,14 +156,14 @@ prepare_request_body self.original_url = self.url cached = original_object_class.read_cached_response(self) if cached && !cached.is_a?(String) if cached.expires && cached.expires > Time.now - Flexirest::Logger.debug " \033[1;4;32m#{Flexirest::NAME}\033[0m #{@instrumentation_name} - Absolutely cached copy found" + Flexirest::Logger.debug " \033[1;4;32m#{Flexirest.name}\033[0m #{@instrumentation_name} - Absolutely cached copy found" return handle_cached_response(cached) elsif cached.etag.to_s != "" #present? isn't working for some reason - Flexirest::Logger.debug " \033[1;4;32m#{Flexirest::NAME}\033[0m #{@instrumentation_name} - Etag cached copy found with etag #{cached.etag}" + Flexirest::Logger.debug " \033[1;4;32m#{Flexirest.name}\033[0m #{@instrumentation_name} - Etag cached copy found with etag #{cached.etag}" etag = cached.etag end end response = ( @@ -315,11 +315,11 @@ base_url = parts[0] end 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}" + Flexirest::Logger.info " \033[1;4;32m#{Flexirest.name}\033[0m #{@instrumentation_name} - Requesting #{connection.base_url}#{@url}" if verbose? Flexirest::Logger.debug "Flexirest Verbose Log:" Flexirest::Logger.debug " Request" Flexirest::Logger.debug " >> #{http_method.upcase} #{@url} HTTP/1.1" @@ -374,22 +374,22 @@ def handle_response(response, cached = nil) @response = response status = @response.status || 200 if cached && response.status == 304 - Flexirest::Logger.debug " \033[1;4;32m#{Flexirest::NAME}\033[0m #{@instrumentation_name}" + + Flexirest::Logger.debug " \033[1;4;32m#{Flexirest.name}\033[0m #{@instrumentation_name}" + ' - Etag copy is the same as the server' return handle_cached_response(cached) end if (200..399).include?(status) if @method[:options][:plain] return @response = response.body elsif is_json_response? || is_xml_response? if @response.respond_to?(:proxied) && @response.proxied - Flexirest::Logger.debug " \033[1;4;32m#{Flexirest::NAME}\033[0m #{@instrumentation_name} - Response was proxied, unable to determine size" + Flexirest::Logger.debug " \033[1;4;32m#{Flexirest.name}\033[0m #{@instrumentation_name} - Response was proxied, unable to determine size" else - Flexirest::Logger.debug " \033[1;4;32m#{Flexirest::NAME}\033[0m #{@instrumentation_name} - Response received #{@response.body.size} bytes" + Flexirest::Logger.debug " \033[1;4;32m#{Flexirest.name}\033[0m #{@instrumentation_name} - Response received #{@response.body.size} bytes" end result = generate_new_object(ignore_xml_root: @method[:options][:ignore_xml_root]) else raise ResponseParseException.new(status:status, body:@response.body) end