I am passing the following request to ruby rest-client gem;
RestClient::Request.execute(method: :get,
url: Config['site_url'] + path,
verify_ssl: OpenSSL::SSL::VERIFY_NONE,
headers: { organisation: 'WEB',
accept: 'application/vnd.xyz.v2+json' })
Gem Versions ruby version 2.3.3 rest-client 2.0.2
I have passed the same request to Postman and I get the response I expected.
I also have a v1 of the API that accepts just ":json" and this also responds as expected so my feeling is that it is something around the
accept: 'application/vnd.xyz.v2+json'
That is causing the problem but I'm not sure what exactly. As my feeling is if there was something wrong with the response then postman would also complain.
The documentation here http://ift.tt/1gn3UII default request headers: rest-client sets Accept: /
Just in case I passed / (although I am assuming * means enter what you need) but this returned the v1 response.
The method, url and verify_ssl are working in multiple other requests. So I don't think there is any issue there either.
Anyone, have any suggestions? Thx
Aucun commentaire:
Enregistrer un commentaire