Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot access response headers for non-successful requests #29

Open
sherrardb opened this issue Sep 11, 2019 · 2 comments
Open

cannot access response headers for non-successful requests #29

sherrardb opened this issue Sep 11, 2019 · 2 comments

Comments

@sherrardb
Copy link

please forgive me if this has been addressed or covered elsewhere.

when encountering API limits, or other requests that result in a non-successful response, FB sometimes provides useful information in the response headers. in our specific case, we occasionally receive

4:- OAuthException:(#4) Application request limit reached
POST /v2.9/ HTTP/1.1
Connection: keep-alive
User-Agent: Facebook::OpenGraph/1.23
Authorization: OAuth ####################
Content-Type: application/x-www-form-urlencoded
Content-Length: 72
Host: graph.facebook.com

there should be a response header 'x-app-usage' that allows us to determine which limit we have exceeded

print $response->header('x-app-usage')."\n";
{"call_count":19,"total_cputime":0,"total_time":40}

but of course since the request method only returns the response object on is_success(), we cannot access that header.

of course i recognize that this is a complex issue from the perspective of the interface that you provide to the FB API, and that indicating failure while still providing access to structured data is not a straight-forward endeavor. my only thoughts as to possible approaches are the method used by DBI where additional error information is available through object and class variables

      $dbh = DBI->connect($data_source, $username, $password)
                or die $DBI::errstr;
      $dbh->commit or die $dbh->errstr;

thanks in advance for your consideration, and please let me know if i need to mock up a proper pull request, or provide further clarification.

@oklahomer
Copy link
Owner

That's a reasonable request. Let me take a look at the current implementation and what can be done during this weekend.

@sherrardb
Copy link
Author

i know that this is a very old request, but i was just circling back to an internal ticket that depends on this and thought to check to see what you had discovered.

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

No branches or pull requests

2 participants