Coder Social home page Coder Social logo

Comments (9)

jarinudom avatar jarinudom commented on June 19, 2024

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.

tarcieri avatar tarcieri commented on June 19, 2024

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.

jarinudom avatar jarinudom commented on June 19, 2024

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.

sferik avatar sferik commented on June 19, 2024

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.

tarcieri avatar tarcieri commented on June 19, 2024

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.

sferik avatar sferik commented on June 19, 2024

Yes, that’s what I meant.

from http.

tarcieri avatar tarcieri commented on June 19, 2024

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.

 avatar commented on June 19, 2024

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.

sferik avatar sferik commented on June 19, 2024

This can be closed, as #39 has been merged.

from http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.