Skip to content

refactor: replace rest-client with net/http#154

Merged
bastelfreak merged 1 commit intovoxpupuli:masterfrom
jay7x:unrest
Jan 6, 2026
Merged

refactor: replace rest-client with net/http#154
bastelfreak merged 1 commit intovoxpupuli:masterfrom
jay7x:unrest

Conversation

@jay7x
Copy link
Member

@jay7x jay7x commented Dec 2, 2025

Closes #153

@Joris29
Copy link

Joris29 commented Dec 2, 2025

Nice PR but some things need to be updated like the spec test and i'm sure not all references to rest-client gem are removed, as i can see it's still in the gemspec file.

@jay7x
Copy link
Member Author

jay7x commented Dec 3, 2025

I spent a while trying to understand what's wrong with the test (besides that multipart/form-data regex).. I'm still unsure if the request body is created properly.. may need another "a while" to figure it out

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Nice. I like relying on fewer external dependencies.

@Joris29
Copy link

Joris29 commented Dec 3, 2025

@jay7x
Copy link
Member Author

jay7x commented Dec 5, 2025

Haha.. found why this test was failing: bblimke/webmock#959..
Webmock doesn't support set_form(). So now I have to choose.. either to stop using webmock for this test, or reimplement set_form() internals here to fill body in a way webmock can deal with.

Here is the actual implementation (this method is called internally): https://github.com/ruby/net-http/blob/master/lib/net/http/generic_request.rb#L314

@jay7x
Copy link
Member Author

jay7x commented Dec 5, 2025

So I reimplemented the unit test with RSpec mocks. Looks good enough from my point of view.

self.password = password
self.token = token
self.api_key = api_key
RestClient.proxy = ENV.fetch('http_proxy', nil)
Copy link
Member Author

@jay7x jay7x Dec 7, 2025

Choose a reason for hiding this comment

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

FYI, net/http respects http_proxy variables by default

@jay7x
Copy link
Member Author

jay7x commented Dec 7, 2025

Updated to reduce the diff even more. Will do all the improvements in another PR.

@bastelfreak bastelfreak added the enhancement New feature or request label Jan 6, 2026
@bastelfreak bastelfreak enabled auto-merge January 6, 2026 12:59
@bastelfreak bastelfreak merged commit 08c347f into voxpupuli:master Jan 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dependency on abandoned gem rest-client

4 participants