public function testGetWithAdditionalGet() { $get = array('a' => array('b@&=' => array('c' => '@d@[]')), 'e' => array('f' => array('&1&', '3', '5'))); $request = $this->spawnRequest(HttpMethod::get(), 'urlGet=really')->setGet($get)->setPost(array('post' => 'value')); $response = $this->spawnClient()->send($request); $this->assertEquals($this->generateString(array('urlGet' => 'really') + $get, array(), array(), ''), $response->getBody()); }
public function testCurlException() { $request = HttpRequest::create()->setUrl(HttpUrl::create()->parse('http://nonexistentdomain.xyz'))->setMethod(HttpMethod::get()); try { $response = CurlHttpClient::create()->setTimeout(3)->send($request); $this->fail(); } catch (NetworkException $e) { $this->assertContains('curl error', $e->getMessage()); } }
protected function loadXRDS($url) { $response = $this->httpClient->send(HttpRequest::create()->setHeaderVar('Accept', self::HEADER_ACCEPT)->setMethod(HttpMethod::get())->setUrl(HttpUrl::create()->parse($url))); if ($response->getStatus()->getId() != 200) { throw new OpenIdException('can\'t fetch document'); } $this->parseXRDS($response->getBody()); return $this; }