Skip to content

Conversation

montymxb
Copy link
Contributor

@montymxb montymxb commented Nov 3, 2017

Adds ParseClient::getServerHealth as a quick way to check on the server health without having to make an arbitrary request to a functional endpoint, and without needing keys.

$health = ParseClient::getServerHealth();
if($health['status'] === 200) {
    // all good!

} else if(isset($health['error']) {
   // error & message instead

   $code = $health['error'];
   $message = $health['error_message'];
   // handle the error...

}

Any response is decoded if possible and added under 'response'.

$health = ParseClient::getServerHealth();

// get status message from the server
$response = $health['response'];
$serverStatus = $response['status'];
// ok

'response' may be a string if it was unable to be decoded. Any additional information the server provides will be available under 'response'.

Tests are added, README is updated and a few adjustments were made in ParseClient to avoid having to maintain duplicate code.

@montymxb montymxb added this to the 1.4.0 milestone Nov 3, 2017
@codecov
Copy link

codecov bot commented Nov 3, 2017

Codecov Report

Merging #366 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #366      +/-   ##
==========================================
+ Coverage   98.92%   98.93%   +<.01%     
==========================================
  Files          36       36              
  Lines        3360     3389      +29     
==========================================
+ Hits         3324     3353      +29     
  Misses         36       36
Impacted Files Coverage Δ
src/Parse/ParseClient.php 99.27% <100%> (+0.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 18ec4d0...5dae498. Read the comment docs.

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

Successfully merging this pull request may close these issues.

1 participant