Skip to content

Adds Server Health Check #366

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

Merged
merged 4 commits into from
Nov 4, 2017
Merged

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