Open espen opened 6 years ago
You should be able to add the right headers or do something like
conn.request :json
conn.response :json, content_type: /\bjson$/
If the README is not clear appreciate some PRs.
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.
Please PR anything! Documentation never hurt.
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 aInvalidRepresentationError
due to the response not beinghal+json
.This works in v0.8.5 but not in the latest version due to https://github.com/codegram/hyperclient/commit/1c7dc4c3d2b0bf311278246f1338de405d08ef84
I'll provide a failing test later.