pixelpeter / laravel5-genderize-api-client

Laravel 5 client for the Genderize.io API
MIT License
46 stars 6 forks source link

Include X-Rate headers only for successfully requests #15

Closed michaelvickersuk closed 3 years ago

michaelvickersuk commented 5 years ago

Genderize does not return the X-Rate headers for unsuccessful requests, eg when the rate limit has been exceeded, missing or incorrect params are supplied. When such an event takes place an error occurs as the $data->headers[X-Rate-*] array key is not set.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.04%) to 98.611% when pulling 91671405ae3f00d96e75d1febe745867cba9fd14 on michaelvickersuk:x-rate-headers-on-success into fde6f31f973fd1e39880c59f138645079b65b576 on pixelpeter:master.

Stroemgren commented 5 years ago

I might push an update to the API in the next days to fix this and return the headers for requests that fail due to limits.

Stroemgren commented 5 years ago

The API now will return the X-Rate-* headers for requests that fail with status 429. Can be either "Request limit reached" or "Request limit too low to process request" for batch requests.

Thanks so much for keeping this repository!

michaelvickersuk commented 5 years ago

Thanks @Stroemgren :+1:

I've now included any requests returning status 429 so the X-Rate-* headers will be available through $response->meta

pixelpeter commented 5 years ago

I will take care of this this weekend. Thanks so far!

michaelvickersuk commented 4 years ago

@pixelpeter please can this be merged

michaelvickersuk commented 3 years ago

Closing due to inactivity and Laravel 5 no longer receiving support