/** * Redirect to a new url */ private function redirect($location) { $locationUrl = new Url($location); // if the location header was relative (bleh) add the host if (!$locationUrl->hasHost()) { $locationUrl = $this->url->getUrlForPath($location); } if ($this->redirects > self::MAXredirects) { throw new Error\BadRequest("Exceeded maximum redirects"); } $this->redirects++; return $this->dispatchRequest(new Request('GET', $locationUrl, $this->headers)); }
public function testGetUrlForMergedParametersWithEmptyQuery() { // url without a fragment currently $url = new Http\Url('http://example.org/'); $newurl = $url->getUrlForMergedParameters(array("key2" => "XXX", "key4" => "val4")); $this->assertEquals('http://example.org/?key2=XXX&key4=val4', (string) $newurl); }