You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@predictionio.apache.org by do...@apache.org on 2018/03/19 00:26:27 UTC

[5/6] predictionio-sdk-php git commit: Use content encoding

Use content encoding

Closes #26


Project: http://git-wip-us.apache.org/repos/asf/predictionio-sdk-php/repo
Commit: http://git-wip-us.apache.org/repos/asf/predictionio-sdk-php/commit/4f3a6e91
Tree: http://git-wip-us.apache.org/repos/asf/predictionio-sdk-php/tree/4f3a6e91
Diff: http://git-wip-us.apache.org/repos/asf/predictionio-sdk-php/diff/4f3a6e91

Branch: refs/heads/master
Commit: 4f3a6e91088dd663d87a9afec5418cc64308461f
Parents: d6916b7
Author: Sebastian Grodzicki <se...@grodzicki.pl>
Authored: Sun Mar 18 17:21:31 2018 -0700
Committer: Donald Szeto <do...@apache.org>
Committed: Sun Mar 18 17:21:31 2018 -0700

----------------------------------------------------------------------
 src/predictionio/BaseClient.php | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/predictionio-sdk-php/blob/4f3a6e91/src/predictionio/BaseClient.php
----------------------------------------------------------------------
diff --git a/src/predictionio/BaseClient.php b/src/predictionio/BaseClient.php
index 13ef8d2..ecec355 100644
--- a/src/predictionio/BaseClient.php
+++ b/src/predictionio/BaseClient.php
@@ -48,8 +48,13 @@ abstract class BaseClient {
    * @throws PredictionIOAPIError Request error
    */
   protected function sendRequest($method, $url, $body) {
-    $options = ['headers' => ['Content-Type' => 'application/json'],
-                'body' => $body]; 
+    $options = [
+      'headers' => [
+        'Accept-Encoding' => 'gzip',
+        'Content-Type' => 'application/json',
+      ],
+      'body' => $body,
+    ];
 
     try {
       $response = $this->client->request($method, $url, $options);