コード例 #1
0
 public function testCustomBaseUri()
 {
     $baseUri = new Uri('http://foo.bar/api/v1/');
     $this->requestFactory = $this->requestFactory->withBaseUri($baseUri);
     $expected = new Request('GET', 'http://foo.bar/api/v1/some/path', ['X-Api-Key' => $this->apiKey->toNative()]);
     $actual = $this->requestFactory->create('GET', new Uri('some/path'));
     $this->assertEquals($expected, $actual);
 }
コード例 #2
0
 /**
  * @param string $method
  * @param UriInterface $uri
  * @return RequestInterface
  */
 public function create($method, UriInterface $uri)
 {
     $uri = Uri::resolve($this->baseUri, $uri);
     $headers = [self::API_KEY_HEADER => $this->apiKey->toNative()];
     return new Request($method, $uri, $headers);
 }