Skip to content

Commit

Permalink
Use root endpoint in getUrl. Closes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
typpo committed Jun 23, 2021
1 parent 8d22bdc commit 5f4d17d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions QuickChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function getUrl() {
$format = $this->format;
$backgroundColor = $this->backgroundColor;

$url = sprintf('%s://%s/chart?c=%s&w=%d&h=%d&devicePixelRatio=%f&format=%s&bkg=%s', $this->protocol, $this->host, $configStr, $width, $height, $devicePixelRatio, $format, $backgroundColor);
$url = sprintf($this->getRootEndpoint() . '/chart?c=%s&w=%d&h=%d&devicePixelRatio=%f&format=%s&bkg=%s', $configStr, $width, $height, $devicePixelRatio, $format, $backgroundColor);

if ($this->apiKey) {
$url .= '&key=' . $this->apiKey;
Expand All @@ -79,7 +79,7 @@ function getUrl() {

function getShortUrl() {
if ($this->host != 'quickchart.io') {
throw new Exception('Short URLs must use quickchart.io host');
throw new Exception('Short URLs must use quickchart.io host');
}
$ch = curl_init($this->getRootEndpoint() . '/chart/create');
$postData = array(
Expand Down

0 comments on commit 5f4d17d

Please sign in to comment.