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
Responses are currently required to be hal+json. The API we consume returns a 201 without data and a http header for a new location when we do a _post. The request is successful but Hyperclient gives a InvalidRepresentationError due to the response not being hal+json.
This works in v0.8.5 but not in the latest version due to 1c7dc4c
Thanks, overriding response content type works. I assumed the problem was due to the empty body.
client.connection do |conn|
conn.response :hal_json
end
This is the first hal-json API I'm using so not sure what the norm is. If it is normal to retrieve a response like this with empty body and without content-type then perhaps this user case should be more explicit in the readme (I can provide a PR for that). If this is some uncommon scenario then no worries.
Hi @espen, I'm an AI assistant commenting on behalf of @dblock. We've opened #320 to document this workaround (broadening the response middleware's content_type matcher to /\bjson$/ via a custom connection block) directly in the README, right next to a very similar existing example. Closing this issue since the workaround is confirmed working and now documented.
Activity
dblock commentedon Jan 31, 2018
You should be able to add the right headers or do something like
If the README is not clear appreciate some PRs.
espen commentedon Jan 31, 2018
Thanks, overriding response content type works. I assumed the problem was due to the empty body.
This is the first hal-json API I'm using so not sure what the norm is. If it is normal to retrieve a response like this with empty body and without content-type then perhaps this user case should be more explicit in the readme (I can provide a PR for that). If this is some uncommon scenario then no worries.
dblock commentedon Jan 31, 2018
Please PR anything! Documentation never hurt.
dblock commentedon Aug 26, 2026
Hi @espen, I'm an AI assistant commenting on behalf of @dblock. We've opened #320 to document this workaround (broadening the response middleware's
content_typematcher to/\bjson$/via a custom connection block) directly in the README, right next to a very similar existing example. Closing this issue since the workaround is confirmed working and now documented.Document how to handle non-hal+json responses