-
Notifications
You must be signed in to change notification settings - Fork 123
Set ignore_errors flag for HTTP requests in PHP client #140
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
Conversation
By default when a HTTP code other than 200 is returned file_get_contents does not return the content. Setting this flag means that the data is always returned and error messages from JIRA can be parsed correctly
|
Please also add tests in https://github.com/chobie/jira-api-restclient/blob/master/tests/Jira/Api/Client/AbstractClientTestCase.php, that would demonstrate that it works. |
|
That throws a PHP error if the ignore_errors flag is not set |
|
|
||
| public function testErrorResponseValueReturned() | ||
| { | ||
| $this->traceRequest(Api::REQUEST_GET, array('http_code' => '403', 'response_mode' => 'trace')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't look to explicit. I expect some predetermined output being sent back from REST endpoint and then assertion made on actual output.
|
Using the existing GET request test? |
| $this->assertEquals($data, $trace_result['_GET']); | ||
| } | ||
|
|
||
| public function getRequestWithKnownHttpCode() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename into getRequestWithKnownHttpCodeDataProvider.
Yes, that looks good. Also mention this change in |
| { | ||
| $data = array('param1' => 'value1', 'param2' => 'value2'); | ||
| $trace_result = $this->traceRequest(Api::REQUEST_GET, $data); | ||
| $trace_result = $this->traceRequest(Api::REQUEST_GET, array_merge(['http_code' => $http_code], $data)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The library is PHP 5.3+ compatible and PHP 5.4+ specific syntax (short arrays in this case) should not be used.
|
Today’s review completed. |
CHANGELOG.md
Outdated
| - Remove trailing slash from endpoint url by [@Procta]. | ||
| - Added local cache to getResolutions by [@jpastoor]. | ||
| - Renamed Api::api() parameter $return_as_json to $return_as_array by [@jpastoor]. | ||
| - ignore_errors flag added to HTTP context by [@betterphp]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- this should be added to
Fixedsection - this a fix to case, when error text not being available as API call result and should be written as Error details from failed API calls were not available back from
Api::apimethod call. - for your nickname to be highlighted on changelog page you also need to add it in mapping at the bottom of this file
|
Is that not when this is 14950cf ? |
|
My bad. You're sending fixes at light speed and I've totally missed that one. Yes, you're correct. |
|
Also it seems, that e-mail you've used to author commits in this PR isn't linked to your account. Because of this:
|
|
I've added the email address to my account which seemed easier than editing history. It was wrong because I'm doing this at work and we use a different git system |
|
Merging, thanks @betterphp . |
|
Next time please send PR from different then |
|
Cool cool, thanks :) |
By default when a HTTP code other than 200 is returned file_get_contents does not return the content. Setting this flag means that the data is always returned and error messages from JIRA can be parsed correctly