Comments (9)
I actually prefer it the way it is, since like 90% of the time you just want the body anyway.
I'm not married to either way though, I'll use it regardless.
from http.
The current API has a lot of limitations, especially around streaming. I do like the convenience which is what I was originally going for. Perhaps there can be convenience methods to get to the body in an easy way
from http.
I really like the AREL-style method chaining and I think it is one of the major draws of this gem (to me, anyway), so maybe in uncertain cases it would be good to look at whatever AREL's philosophy is (which I think would probably point to the HTTP.get(url).body method you pointed to above).
from http.
We could alias HTTP::Response#to_s
to HTTP::Response#body
such this would return the response body as a string:
"#{HTTP.get(url)}"
from http.
We'd need to delegate HTTP::Response#to_s
to HTTP::ResponseBody#to_s
actually.
I have a broken WIP implementing some of these changes I can link which might help clarify this stuff ;)
from http.
Yes, that’s what I meant.
from http.
Code speaks louder than words. Here's a WIP. I need to finagle it a little more, pulling in some of the other stuff from Reel: #39
from http.
haven't used this gem yet but i think i'd prefer HTTP.verb()
to return a response.
body = HTTP.get(…).body
looks good to me.
from http.
This can be closed, as #39 has been merged.
from http.
Related Issues (20)
- feature request: happy eyeballs
- Can we update to llhttp-ffi 0.5.0 HOT 2
- access ssl certificate details? HOT 4
- Issues running it on Mac Intel (12.6) HOT 3
- SSLERROR occurred when running http method in the executable file: certificate verify failed. HOT 1
- 403 and 404 responses for valid URLs HOT 7
- raise error when invalid hash is passed to timeout HOT 1
- Are you open to include rspec_matchers? HOT 18
- File descriptor / socket leak when timeout occurs during initialization
- How to query the remote server address? HOT 1
- Make HTTP::Feature work like rack middleware HOT 10
- Remove auth header after following a redirect to a different origin
- Support HTTP headers streaming HOT 2
- Timeout redesign for 6.x HOT 4
- Fix Base64 dependency warning HOT 4
- Version 5.x bump? HOT 3
- project level timeout HOT 2
- `HTTP::Response::Body#each` and `BUFFER_SIZE`
- Feature Request: Better Control of Logging for Binary Request Body / Response Body
- Bug: Using Logger Breaks Request Streaming
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http.