Skip to content

Commit

Permalink
Merge pull request #19 from ncareau/fix-error-messsage
Browse files Browse the repository at this point in the history
Remove 's' in X-BambooHR-Error-Messsage
  • Loading branch information
jlesueur authored Apr 1, 2019
2 parents e82c5aa + 64a792d commit 749afcc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion BambooHR/BambooHTTPResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function getContent() {
*/
public function getErrorMessage() {
if ($this->isError()) {
return isset($this->headers['X-BambooHR-Error-Messsage']) ? $this->headers['X-BambooHR-Error-Messsage'] : $this->getContent();
return isset($this->headers['X-BambooHR-Error-Message']) ? $this->headers['X-BambooHR-Error-Message'] : $this->getContent();
}
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion examples.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
$fields = array('lastName', 'firstName', 'employeeNumber');
$response = $api->getCustomReport('xml',$fields);
if($response->isError()){
//for many errors, Bamboo will add a header "X-BambooHR-Error-Messsage" that describes the error. These messages are meant for debugging purposes.
//for many errors, Bamboo will add a header "X-BambooHR-Error-Message" that describes the error. These messages are meant for debugging purposes.
trigger_error("Problem with custom report: " . $response->getErrorMessage());
}

4 changes: 2 additions & 2 deletions tests/BambooHTTPRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,15 @@ public function testGetErrorMessage()
$errorBody = 'Test Body Error';

$response = new BambooHTTPResponse();
$response->headers['X-BambooHR-Error-Messsage'] = $errorHeader;
$response->headers['X-BambooHR-Error-Message'] = $errorHeader;
$response->content = $errorBody;
$response->statusCode = 200;
$this->assertNull(
$response->getErrorMessage()
);

$response = new BambooHTTPResponse();
$response->headers['X-BambooHR-Error-Messsage'] = $errorHeader;
$response->headers['X-BambooHR-Error-Message'] = $errorHeader;
$response->content = $errorBody;
$response->statusCode = 500;
$this->assertSame(
Expand Down

0 comments on commit 749afcc

Please sign in to comment.