Imagine I get some HAL from a server that looks like this (in part, maybe):
{
'_links': {
'self': { 'href': '/users/12345' },
'profile_image': { 'href': '/user/12345/face' }
}
}
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?
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.resourceI get back a sort of confusedHyperclient::Resourcethat can't tell me the media type is jpeg or whatever. I could callgetinstead 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/jsonand that a user could add to), it just hands over theFaraday::Responseobject or something similar. Basically, it punts and says, "This isn't hypermedia I know about, you handle this bullshit."Thoughts?