See also: http://github.com/pda/phool
Author: Paul Annesley (paul@annesley.cc)
Ejemplo n.º 1
0
 /**
  * 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));
 }
Ejemplo n.º 2
0
 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);
 }