Skip to content

Commit

Permalink
Merge pull request #2 from div-art/bitly_v4
Browse files Browse the repository at this point in the history
fix of shorten link without protocol
  • Loading branch information
IevgeniiDomanskyi committed Sep 27, 2018
2 parents c4811a3 + f6b09b3 commit eb2f7ac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Services/Bitly.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public function bitly($longUrl, $withProtocol = true)

$this->validation(func_get_args()[0]);

$url = parse_url($longUrl);
if ( ! isset($url['scheme'])) {
$longUrl = 'http://' . $longUrl;
}

$response = $this->client->request('POST', config('shortlink.bitly.url') . '/shorten', [
'headers' => [
'Authorization' => 'Bearer '.config('shortlink.bitly.key'),
Expand Down

0 comments on commit eb2f7ac

Please sign in to comment.