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

HTTP requests library #21

Open
zachallaun opened this issue Mar 21, 2013 · 4 comments
Open

HTTP requests library #21

zachallaun opened this issue Mar 21, 2013 · 4 comments
Assignees

Comments

@zachallaun
Copy link
Member

Something similar to Python's Requests would be nice.

@chuckha
Copy link
Member

chuckha commented Mar 21, 2013

How does this look for a basic API?

response     = request("http://duckduckgo.com", "GET", {"q" => "dogs"})
response_two = request("http://httpbin.org/post", "POST", {"name" => "chuck"})

@ghost ghost assigned chuckha Mar 21, 2013
@zachallaun
Copy link
Member Author

Looks great. Implicit SSL would be nice too: request("https://blah.com", GET)

@StefanKarpinski
Copy link
Member

Using integers for the request seems sensible, although it might get to a point where you want to make a custom type for HTTP request types. It would be nice to be able to give the url but also be able to give protocol. E.g.

request(GET, HTTP, "httpbin.org/post", {"q"=>"dogs"})

The reason that's nice is so that it can be set programmatically more easily. I also think it makes sense to put the method first or, if omitted, default to GET.

@chuckha
Copy link
Member

chuckha commented Mar 22, 2013

Integers for the HTTP method seems fine, but as far as protocol goes, this library's scope is only HTTP/S requests. If it turns out we need more than those two protocols we can add another method to request().

I also like the method first.

request(POST, "http://duckduckgo.com", {"q" => "hacker school"})
request("https://google.com") # implicit GET

@chuckha chuckha mentioned this issue Mar 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants