Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[debug_output]: Remove the section that reads bytes, or specify the length of bytes to display in the console!! #806

Open
motebaya opened this issue Aug 9, 2024 · 1 comment

Comments

@motebaya
Copy link

motebaya commented Aug 9, 2024

it looks like this is a duplicate of #715, but there’s been no response so far.

let say i have this code:

require 'httparty'
require_relative 'lib/Logging'

logger = Logging.new(progname: 'httparty', level: Logger::DEBUG)

HTTParty::Basement.debug_output(logger)
response = HTTParty.get('https://jsonplaceholder.typicode.com/todos/1')
puts response.body

Imagine calling a JSON that’s 100MB in size and having all its bytes displayed in the console! That would waste a lot of time handling I/O operations dude, and i'd have to scroll way up just to see the headers.

Screenshot 2024-08-09 200359

i hope there will be a feature added to disable byte display in the console or limit the length of bytes.

look at python; it handles this very well. i wish HTTParty could do the same.

Screenshot 2024-08-09 202456

@motebaya
Copy link
Author

i know this is just a wrapper around the built-in Net::HTTP module, but HTTParty doesn’t handle the messy output in debug mode at all. it's ok, this might be able to fix it with creating custom logger: https://gist.github.com/motebaya/d3436ec35874a342e01da10170c85bca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant