diff options
| -rw-r--r-- | lib/net/hippie/client.rb | 4 | ||||
| -rw-r--r-- | lib/net/hippie/connection.rb | 2 | ||||
| -rw-r--r-- | lib/net/hippie/rust_backend.rb | 2 | ||||
| -rw-r--r-- | lib/net/hippie/rust_connection.rb | 26 |
4 files changed, 15 insertions, 19 deletions
diff --git a/lib/net/hippie/client.rb b/lib/net/hippie/client.rb index e4bfba8..a557449 100644 --- a/lib/net/hippie/client.rb +++ b/lib/net/hippie/client.rb @@ -3,13 +3,13 @@ module Net module Hippie # HTTP client with connection pooling, automatic retries, and JSON-first defaults. - # + # # The Client class provides the core HTTP functionality for Net::Hippie, supporting # all standard HTTP methods with intelligent defaults for JSON APIs. Features include: # # * Connection pooling and reuse per host # * Automatic retry with exponential backoff - # * Redirect following with configurable limits + # * Redirect following with configurable limits # * TLS/SSL support with client certificates # * Comprehensive timeout configuration # * Pluggable content-type mapping diff --git a/lib/net/hippie/connection.rb b/lib/net/hippie/connection.rb index 73b5d84..6dfae87 100644 --- a/lib/net/hippie/connection.rb +++ b/lib/net/hippie/connection.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative 'rust_backend' - module Net module Hippie # Connection abstraction layer that supports both Ruby and Rust backends. diff --git a/lib/net/hippie/rust_backend.rb b/lib/net/hippie/rust_backend.rb index d25abf7..f8a5fb6 100644 --- a/lib/net/hippie/rust_backend.rb +++ b/lib/net/hippie/rust_backend.rb @@ -204,4 +204,4 @@ module Net end end end -end
\ No newline at end of file +end diff --git a/lib/net/hippie/rust_connection.rb b/lib/net/hippie/rust_connection.rb index fc5d4c6..cae6c38 100644 --- a/lib/net/hippie/rust_connection.rb +++ b/lib/net/hippie/rust_connection.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require_relative 'rust_backend' - module Net module Hippie # Rust-powered HTTP connection with debug logging support. @@ -38,7 +36,7 @@ module Net @port = port @options = options @logger = options[:logger] - + # Create the Rust client (simplified version for now) @rust_client = Net::Hippie::RustClient.new end @@ -55,10 +53,10 @@ module Net begin rust_response = @rust_client.public_send(method.downcase, url, headers, body) response = RustBackend::ResponseAdapter.new(rust_response) - + # Debug log response log_response(response) if @logger - + response rescue => e # Map Rust errors to Ruby equivalents @@ -100,19 +98,19 @@ module Net def log_request(method, url, headers, body) # Format similar to Net::HTTP's debug output @logger << "-> \"#{method.upcase} #{url} HTTP/1.1\"\n" - + # Log headers headers.each do |key, value| @logger << "-> \"#{key.downcase}: #{value}\"\n" end - + @logger << "-> \"\"\n" # Empty line - + # Log body if present if body && !body.empty? @logger << "-> \"#{body}\"\n" end - + @logger.flush if @logger.respond_to?(:flush) end @@ -126,7 +124,7 @@ module Net def log_response(response) # Format similar to Net::HTTP's debug output @logger << "<- \"HTTP/1.1 #{response.code}\"\n" - + # Log some common response headers if available %w[content-type content-length location server date].each do |header| value = response[header] @@ -134,16 +132,16 @@ module Net @logger << "<- \"#{header}: #{value}\"\n" end end - + @logger << "<- \"\"\n" # Empty line - + # Log response body (truncated if too long) body = response.body if body && !body.empty? display_body = body.length > 1000 ? "#{body[0...1000]}...[truncated]" : body @logger << "<- \"#{display_body}\"\n" end - + @logger.flush if @logger.respond_to?(:flush) end @@ -165,4 +163,4 @@ module Net end end end -end
\ No newline at end of file +end |
