public function getFields($asString = false) { if (!$asString) { return $this->fields; } $query = new Query($this->fields); return (string) $query->setEncodingType(Query::RFC1738)->setAggregator($this->getAggregator()); }
public function testCanSpecifyRfc3986UrlEncodingType() { $q = new Query(['bar abc' => 'bam boozle', 'ሴ' => 'hi']); $q->setEncodingType(Query::RFC3986); $this->assertEquals('bar%20abc=bam%20boozle&%E1%88%B4=hi', (string) $q); }
public function testCanUseUrlWithCustomQuery() { $client = new Client(); $url = Url::fromString('http://foo.com/bar'); $query = new Query(['baz' => '123%20']); $query->setEncodingType(false); $url->setQuery($query); $r = $client->createRequest('GET', $url); $this->assertEquals('http://foo.com/bar?baz=123%20', $r->getUrl()); }