Skip to content

Allow Net::HTTP.get, get_response, post, post_form, put to receive URI String #24

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kyanagi
Copy link

@kyanagi kyanagi commented May 1, 2021

We need to pass a URI object to Net::HTTP.get_response (or Net::HTTP.get).

Net::HTTP.get_response(URI('http://www.example.com/index.html'))

With this patch, these methods can receive a URI-string.

Net::HTTP.get_response('http://www.example.com/index.html')

@k0kubun
Copy link
Member

k0kubun commented May 1, 2021

For consistency, supporting the same thing for Net::HTTP.post as well might be useful.

@kyanagi kyanagi force-pushed the http_get_response_with_uri_string branch from c639473 to 7a4dc8d Compare May 1, 2021 11:40
@kyanagi
Copy link
Author

kyanagi commented May 1, 2021

@k0kubun
Thank you for your suggestion.
I added the same support for Net::HTTP.post and Net::HTTP.post_form.

@tachyons
Copy link

This looks cool, @k0kubun Does this have any blockers ?

@k0kubun
Copy link
Member

k0kubun commented Jun 24, 2025

I left a comment because I contributed a similar feature, but I'm not the maintainer. You need to ping the actual maintainer https://github.com/ruby/ruby/blob/master/doc/maintainers.md#libnethttprb-libnethttpsrb after fixing the conflict.

@kyanagi kyanagi force-pushed the http_get_response_with_uri_string branch from 7a4dc8d to 0674aef Compare June 25, 2025 01:12
@kyanagi kyanagi changed the title Net::HTTP.get_response can receive URI as string Allow Net::HTTP.get, get_response, post, post_form, put to receive URI String Jun 25, 2025
@kyanagi
Copy link
Author

kyanagi commented Jun 25, 2025

I resolved the conflicts.
I also updated the put method, which didn't exist when I created this PR, to accept a String.

@nurse What do you think of this?

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.

3 participants