Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Status code not set in response #28

Open
MonikaMahanthappa opened this issue Mar 4, 2015 · 2 comments
Open

Status code not set in response #28

MonikaMahanthappa opened this issue Mar 4, 2015 · 2 comments

Comments

@MonikaMahanthappa
Copy link

In case of 404 status_code is not getting set in response. Im are using api_v2 branch.

chargify = Chargify2::Client.new(api_id: <masked>, api_password: <masked>, base_uri: 'https://api.chargify.com/api/v2')
chargify.customers.read(1)

<Chargify2::Response:0x007f8c1d878ec0 @resource=#<Chargify2::Customer>, @meta=#<Hashie::Mash errors=[#<Hashie::Mash attribute=nil kind="not_found" message="The requested Customer could not be found.">]>, @status_code=nil, @errors=[#<Hashie::Mash attribute=nil kind="not_found" message="The requested Customer could not be found.">]>

When I tried to hit the api directly, i could see status_code being sent in the chargify api response. So guessing the issue to be in the gem.

curl -v -u  <api_id>:x -H Accept:application/json -H Content-Type:application/json https://mavenhive-ghuk.chargify.com/customers/1
* Hostname was NOT found in DNS cache
*   Trying 54.244.7.151...
* Connected to mavenhive-ghuk.chargify.com (54.244.7.151) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
* Server certificate: *.chargify.com
* Server certificate: COMODO RSA Organization Validation Secure Server CA
* Server certificate: COMODO RSA Certification Authority
* Server certificate: AddTrust External CA Root
* Server auth using Basic with user 'dvLih3EFHkpluaBrGP7A'
> GET /customers/1 HTTP/1.1
> Authorization: Basic ZHZMaWgzRUZIa3BsdWFCckdQN0E6eA==
> User-Agent: curl/7.37.1
> Host: mavenhive-ghuk.chargify.com
> Accept:application/json
> Content-Type:application/json
>
< HTTP/1.1 404 Not Found
< Cache-Control: no-cache, private
< Content-Type: application/json; charset=utf-8
< Date: Wed, 04 Mar 2015 11:27:09 GMT
< P3p: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
* Server nginx + Phusion Passenger is not blacklisted
< Server: nginx + Phusion Passenger
< Set-Cookie: _chargify_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFVEkiJTRlMjNlMGVjZGYzOWRkZDAyYmVlZDViOGJmNGM2MzhjBjsAVEkiF3NlbGxlcl9jcmVkZW50aWFscwY7AEZJIgGAZTJlYjBjOTViOWRkZWY2NWYwYTNlZDk4NDYwYmNjN2FlYzFmNzJmNjgxNWRmOWYyMTI4MGJjODgzMmY2NzIyNTczMzlhMjA2NzI5YjU4Y2RiM2RlOWY3YjJhN2YwZTIwMDQ2NzE5YmY0YTM5M2IxYjVlMmY0MzY4MTE0YjU2YzAGOwBGSSIac2VsbGVyX2NyZWRlbnRpYWxzX2lkBjsARmkCsjw%3D--b0cc8c93ff92f3de8d3abf63671acb887fa8b82b; domain=.chargify.com; path=/; secure; HttpOnly
< Status: 404 Not Found
< X-Frame-Options: SAMEORIGIN
< X-Powered-By: Phusion Passenger
< X-Rack-Cache: miss
< X-Ratelimit-Limit: 1000000
< X-Ratelimit-Remaining: 999982
< X-Ratelimit-Reset: 1425513600
< X-Request-Id: f2ab412e-9ab7-464a-88df-695e555b852a
< X-Runtime: 0.029060
< X-Ua-Compatible: IE=Edge,chrome=1
< Content-Length: 1
< Connection: keep-alive
<
* Connection #0 to host mavenhive-ghuk.chargify.com left intact

@bhavinjavia
Copy link

Hello Chargify team,

I am @MonikaMahanthappa's colleague and I ran into same issue (nil @status_code resulting in response.successful? to be false even though the API call was successful). This time, it was the POST /allocations API of V2.

When I switched our code to hit API V1 Allocations endpoint, it started working.

I suspect something has changed recently in API V2 which is causing this bug in this gem. I will try to report to Chargify support and see what I can find.

Meanwhile, we have stopped using this gem and fallen back to our custom Chargify api client.

@jeremywrowe
Copy link
Contributor

Thanks for the report @bhavinjavia. We will look into the issue further. If you find any more information please let us know.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants