Skip to content
This repository has been archived by the owner on May 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #11 from findbrok/master
Browse files Browse the repository at this point in the history
Bug Fix: Append correct query parameters to URL.
  • Loading branch information
percymamedy authored Mar 12, 2017
2 parents c791a75 + 98c97f9 commit 929f07a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/AbstractPersonalityInsights.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ abstract class AbstractPersonalityInsights implements InsightsContract
*
* @var array
*/
protected $headers = [
'Accept' => 'application/json',
];
protected $headers = ['Accept' => 'application/json'];

/**
* Request Query.
Expand Down Expand Up @@ -152,7 +150,7 @@ protected function getQuery()

// We have something in the result.
if (! empty($finalQueryString)) {
rtrim($finalQueryString, '&');
$finalQueryString = rtrim($finalQueryString, '&');
}

// We return our results.
Expand All @@ -172,9 +170,16 @@ protected function sendRequest()
// Make a Watson Bridge.
$watsonBridge = $this->makeBridge();

// Get Url We post to Watson to Get Profile.
$postUrl = $accessManager->getProfileResourcePath();

// Append query string if needed
if (! empty($this->getQuery())) {
$postUrl .= '?'.$this->getQuery();
}

// Cross the Bridge and return the Response.
return $watsonBridge->post($accessManager->getProfileResourcePath().$this->getQuery(),
$this->getContainer()->getContentsForRequest());
return $watsonBridge->post($postUrl, $this->getContainer()->getContentsForRequest());
}

/**
Expand Down

0 comments on commit 929f07a

Please sign in to comment.