Skip to content

Commit

Permalink
URL decode response body before checking 503 error message
Browse files Browse the repository at this point in the history
  • Loading branch information
coop182 committed Sep 22, 2015
1 parent 5be82a6 commit fbb8c03
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/XeroPHP/Remote/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ public function parse() {
case Response::STATUS_RATE_LIMIT_EXCEEDED:
case Response::STATUS_ORGANISATION_OFFLINE:
//There must be a better way than this?
if(false !== stripos($this->response_body, 'Organisation is offline')){
$response = urldecode($this->response_body);
if(false !== stripos($response, 'Organisation is offline')){
throw new OrganisationOfflineException();
} elseif(false !== stripos($this->response_body, 'Rate limit exceeded')){
} elseif(false !== stripos($response, 'Rate limit exceeded')){
throw new RateLimitExceededException();
} else {
throw new NotAvailableException();
Expand Down Expand Up @@ -263,4 +264,4 @@ public function parseHTML() {
}


}
}

0 comments on commit fbb8c03

Please sign in to comment.