コード例 #1
0
 public function testGet()
 {
     $response = $this->client->get('http://localhost:8080/yo', ['Foo: Bar']);
     $server = $this->getRequestData($response);
     $this->assertEquals('/yo', $server['uri']);
     $this->assertEquals('Bar', $server['headers']['Foo']);
     $this->assertEquals('GET', $server['method']);
     $this->assertEquals(null, $server['raw_post']);
 }
コード例 #2
0
ファイル: Uber.php プロジェクト: f3ath/simpleuber
 /**
  * @param string $uri
  * @param array $query
  * @return object
  * @throws ApiException
  */
 public function get($uri, array $query = array())
 {
     $fullUrl = $this->url . $uri;
     if ($query) {
         $fullUrl .= '?' . http_build_query($query);
     }
     $response = $this->http->get($fullUrl, array(sprintf('Authorization: Token %s', $this->token)));
     $json = json_decode($response->getBody());
     if ($response->getCode() !== 200) {
         throw ApiException::create($response->getCode(), $json);
     }
     return $json;
 }