Skip to content

Comments

refactor: replace HTTParty with standard Ruby Net::HTTP#18

Merged
billybonks merged 1 commit intomasterfrom
burn/http-party
Mar 8, 2025
Merged

refactor: replace HTTParty with standard Ruby Net::HTTP#18
billybonks merged 1 commit intomasterfrom
burn/http-party

Conversation

@billybonks
Copy link
Contributor

Remove HTTParty dependency and refactor Claude client to use Ruby's standard Net::HTTP library. This change reduces external dependencies which were causing errors on some systems while maintaining the same functionality. The HTTP request handling is now implemented using built-in Ruby libraries, making the application more stable across different environments and reducing the dependency surface area.

Remove HTTParty dependency and refactor Claude client to use Ruby's standard
Net::HTTP library. This change reduces external dependencies which were causing
errors on some systems while maintaining the same functionality.
The HTTP request handling is now implemented using built-in Ruby libraries,
making the application more stable across different environments and reducing
the dependency surface area.
@billybonks billybonks merged commit e1c5d63 into master Mar 8, 2025
2 checks passed
@billybonks billybonks deleted the burn/http-party branch March 8, 2025 10:38
Copy link

@managerbot-app managerbot-app bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏿 👎🏿 review comments so that we know what works and what does not work

spec.executables = %w[committer]
spec.require_paths = ['lib']

spec.add_dependency 'httparty', '~> 0.20'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the httparty dependency here but still using it in the code will cause runtime errors. Make sure to update all usage of httparty or keep the dependency.


require 'json'
require 'httparty'
require 'net/http'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching from HTTParty to standard library Net::HTTP is good for reducing dependencies, but ensure you're handling all error cases properly with the new implementation.

request['content-type'] = 'application/json'
request['x-api-key'] = @config['api_key']
request.body = body.to_json

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value has changed. The previous HTTParty.post returned a Response object with various methods, but now you're returning a parsed JSON hash. Ensure all callers of this method can handle the new return type.


response = http.request(request)
JSON.parse(response.body)
rescue JSON::ParserError
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding more specific error handling for different HTTP status codes (like 401, 403, 429, 500) to provide better error messages.

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

Successfully merging this pull request may close these issues.

1 participant