Use content encoding
authorSebastian Grodzicki <sebastian@grodzicki.pl>
Mon, 19 Mar 2018 00:21:31 +0000 (17:21 -0700)
committerDonald Szeto <donald@apache.org>
Mon, 19 Mar 2018 00:21:31 +0000 (17:21 -0700)
Closes #26

src/predictionio/BaseClient.php

index 13ef8d2..ecec355 100644 (file)
@@ -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);