Skip to content

Commit

Permalink
feat: user agent and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
florianv committed Aug 1, 2024
1 parent 09183c7 commit 3ad15f6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Service/HttpService.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ private function buildRequest($url, array $headers = []): RequestInterface
$request = $request->withHeader($header, $value);
}

$request = $request->withHeader('User-Agent', 'Swap');

return $request;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Tests/Service/ApiLayer/CurrencyDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function it_fetches_a_rate()
public function it_fetches_a_historical_rate()
{
$pair = CurrencyPair::createFromString('USD/AED');
$uri = 'http://apilayer.net/api/historical?apikey=secret&date=2015-05-06';
$uri = 'https://api.apilayer.com/currency_data/historical?apikey=secret&date=2015-05-06';
$content = file_get_contents(__DIR__.'/../../../Fixtures/Service/ApiLayer/CurrencyData/historical_success.json');
$date = new \DateTime('2015-05-06');
$expectedDate = new \DateTime();
Expand Down
2 changes: 1 addition & 1 deletion tests/Tests/Service/ApiLayer/ExchangeRatesDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function errorResponsesProvider(): array
public function it_fetches_a_rate()
{
$pair = CurrencyPair::createFromString('EUR/USD');
$uri = 'https://api.apilayer.com/exchangerates_data/latest?base=EUR&api_key=x&symbols=USD';
$uri = 'https://api.apilayer.com/exchangerates_data/latest?base=EUR&apikey=x&symbols=USD';
$content = file_get_contents(__DIR__.'/../../../Fixtures/Service/ApiLayer/ExchangeRatesData/latest.json');

$service = new ExchangeRatesData(
Expand Down

0 comments on commit 3ad15f6

Please sign in to comment.