Add custom #inspect to core classes for console readability#77
Merged
Conversation
0x676e67
approved these changes
May 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
All Wreq classes currently use Ruby's default
#inspect, which dumps unhelpful output like#<Wreq::Response:0x0000000120b11798>in IRB/Pry. This makes debugging tedious because you can't see status codes, headers, or cookie details at a glance.What changed
Added
#inspectto 7 core classes with compact, informative output:Response#to_snow returns body text (matching HTTP.rb, HTTParty, RestClient conventions), soputs responseprints the body rather than the debug summary.Note
Medium Risk
Mostly debug/console-output changes, but
Response#to_sbehavior changes and could affect callers relying on the previous string representation.Overview
Adds custom
#inspectimplementations forWreq::Client,Wreq::Headers,Wreq::Cookie,Wreq::Jar,Wreq::StatusCode, andWreq::Versionto provide compact, non-sensitive console output (e.g., counts/flags vs. dumping object ids or cookie values).Changes
Wreq::Responsesoto_snow returns the response body (text) and moves the prior compact debug formatting toinspect(including status, optionalcontent-type, and formatted body size). Addstest/inspect_test.rbto cover the newinspect/to_sexpectations across these types.Reviewed by Cursor Bugbot for commit c338694. Bugbot is set up for automated code reviews on this repo. Configure here.