-
Notifications
You must be signed in to change notification settings - Fork 37
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
Dealing With Other Media Types #42
Comments
Oh. One more thing: This sort of ties into #41 in that, if |
+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: