You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And I am super interested in profile images, so I want to get that sucker. Right now, if I call, you know, user.links.profile_image.resource I get back a sort of confused Hyperclient::Resource that can't tell me the media type is jpeg or whatever. I could call get instead of resource, but then I have to know more about the foreign API.
I wonder if we shouldn't make it so that Hyperclient, when it sees a response from a server that isn't Content-Type: application/hal+json (or maybe a list to include normal application/json and that a user could add to), it just hands over the Faraday::Response object or something similar. Basically, it punts and says, "This isn't hypermedia I know about, you handle this bullshit."
Thoughts?
The text was updated successfully, but these errors were encountered:
Oh. One more thing: This sort of ties into #41 in that, if Link#resource isn't a thing, and everyone always used the methods named after HTTP verbs, then those methods would be the point where we'd do the intelligent thing.
+1, I think that it would be very helpful to differentiate the media types when following hyperlinks. Definitely return some base type that's not JSON to start.
In #73 I made a change that returned Resource objects from all these methods. We could just examine the content type of the response before assigning these and return something else.
Imagine I get some HAL from a server that looks like this (in part, maybe):
And I am super interested in profile images, so I want to get that sucker. Right now, if I call, you know,
user.links.profile_image.resource
I get back a sort of confusedHyperclient::Resource
that can't tell me the media type is jpeg or whatever. I could callget
instead ofresource
, but then I have to know more about the foreign API.I wonder if we shouldn't make it so that Hyperclient, when it sees a response from a server that isn't
Content-Type: application/hal+json
(or maybe a list to include normalapplication/json
and that a user could add to), it just hands over theFaraday::Response
object or something similar. Basically, it punts and says, "This isn't hypermedia I know about, you handle this bullshit."Thoughts?
The text was updated successfully, but these errors were encountered: