Skip to content

Commit

Permalink
Fix url encode and fix return of api
Browse files Browse the repository at this point in the history
  • Loading branch information
emersonsm committed Aug 23, 2017
1 parent 5da5ea5 commit 8b110a1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/DuckDuckGo/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public function zeroClickQuery(string $query)
$http = new Http();
try {
$response = $http->request("GET", $url);
return $response->getBody()->getContents();
return json_decode($response->getBody()->getContents());
} catch (ClientException $e) {
throw new Exception($e->getResponse()->getBody()->getContents(), $e->getResponse()->getStatusCode());
throw new Exception($e->getResponse()->getBody(), $e->getResponse()->getStatusCode());
} catch (ServerException $e) {
throw new Exception("Could not retrieve API result.", 503);
}
Expand All @@ -56,7 +56,7 @@ public function BuildUrl(string $query)
$misc = new Misc();

$parameters = [
"q" => urlencode($query),
"q" => $query,
"format" => $misc->getConfig("format"),
"no_html" => $misc->getConfig("html"),
"no_redirect" => 1,
Expand Down

0 comments on commit 8b110a1

Please sign in to comment.