public function testgGetGuzzleOptionsWithBasePath() { $builder = new RequestBuilder(['domain' => 'www.domain.com', 'basePath' => '/api', 'method' => 'get']); $options = $builder->getGuzzleOptions(); $this->assertArrayHasKey('base_uri', $options); $this->assertEquals('www.domain.com/api', $options['base_uri']); }
public function fetchKeys($iss) { $url = "{$iss}.well-known/jwks.json"; if (($secret = $this->cache->get($url)) === null) { $secret = []; $request = new RequestBuilder(array('domain' => $iss, 'basePath' => '.well-known/jwks.json', 'method' => 'GET', 'guzzleOptions' => $this->guzzleOptions)); $jwks = $request->call(); foreach ($jwks['keys'] as $key) { $secret[$key['kid']] = $this->convertCertToPem($key['x5c'][0]); } $this->cache->set($url, $secret); } return $secret; }
public function __call($name, $arguments) { $builder = new RequestBuilder(array('domain' => $this->domain, 'method' => $name, 'path' => array($this->basePath))); return $builder->withHeaders($this->headers); }
public function testFullUrl() { $builder = new RequestBuilder(['domain' => 'www.domain.com', 'method' => 'get']); $builder->path(2)->subpath()->withParams([['key' => 'param1', 'value' => 'value1'], ['key' => 'param2', 'value' => 'value2']]); $this->assertEquals('www.domain.com/path/2/subpath?param1=value1¶m2=value2', $builder->getUrl()); }