public function testCustom() { $response = $this->client->request('OPTIONS', 'http://localhost:8080/yo', 'boo', ['Foo: Bar']); $server = $this->getRequestData($response); $this->assertEquals('/yo', $server['uri']); $this->assertEquals('Bar', $server['headers']['Foo']); $this->assertEquals('OPTIONS', $server['method']); $this->assertEquals('boo', $server['raw_post']); }
/** * @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; }