Skip to content

Commit

Permalink
Merge pull request #37 from ash-jc-allen/v2.2.0
Browse files Browse the repository at this point in the history
V2.2.0
  • Loading branch information
ash-jc-allen authored Feb 27, 2020
2 parents 6a56c15 + 7a6cfad commit 5bb436d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Changelog

**2.2.0 (released 2020-02-27):**
- Added a default option to enforce HTTPS on destination URLs as a config option. [#36](https://github.com/ash-jc-allen/short-url/pull/36)

**2.1.0 (released 2020-02-19):**
- Added the key salt (used for generating random URL keys) as a config option. [#32](https://github.com/ash-jc-allen/short-url/pull/32)


**2.0.0 (released 2020-02-14):**
- Added the functionality to track a visitor's referer URL.
- Added the functionality to track a user's device type.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ Note: A contribution guide will be added soon.
- [Ash Allen](https://ashallendesign.co.uk)
- [Jess Pickup](https://jesspickup.co.uk) (Logo)
- [Nathan Giesbrecht](https://github.com/NathanGiesbrecht)
- [Carlos A. Escobar](https://github.com/carlosjs23)
- [All Contributors](https://github.com/ash-jc-allen/short-url/graphs/contributors)

## Changelog
Expand All @@ -501,7 +502,6 @@ Check the [CHANGELOG](CHANGELOG.md) to get more information about the latest cha

Check the [UPGRADE](UPGRADE.md) guide to get more information on how to update this library to newer versions.


## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
12 changes: 6 additions & 6 deletions config/short-url.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
| from using the default route that comes with this library.
| This allows you to define your own route that points to
| the controller at:
|
| AshAllenDesign\ShortURL\Controllers\ShortURLController
|
*/
Expand All @@ -22,13 +22,13 @@
| Enforce HTTPS in the destination URL
|--------------------------------------------------------------------------
|
| Here you may specify if the visitor is redirected to the HTTPS version
| of the destination URL. This can be particularly useful if you're allowing
| your web app users to create their own shortened URLS and you don't want to
| use the secure() method in every occasion.
| Here you may specify if the visitor is redirected to the HTTPS
| version of the destination URL by default. This option can be
| overridden when creating the short URL with the ->secure()
| method.
|
*/
'enforce_https' => true,
'enforce_https' => true,

/*
|--------------------------------------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions src/Classes/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ protected function validateDefaultRouteOption(): bool
}

/**
* Validate that the enforce_https option
* is a boolean.
* Validate that the enforce_https option is a boolean.
*
* @return bool
* @throws ValidationException
Expand Down
9 changes: 9 additions & 0 deletions tests/Unit/Classes/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ public function destination_url_is_not_changed_to_https_if_enforce_https_flag_is
$this->assertEquals('http://domain.com', $shortUrl->destination_url);
}

/** @test */
public function destination_url_is_changed_to_https_if_enforce_https_flag_is_set_to_false_in_the_config_but_set_when_creating_url()
{
Config::set('short-url.enforce_https', false);
$builder = new Builder();
$shortUrl = $builder->destinationUrl('http://domain.com')->secure()->make();
$this->assertEquals('https://domain.com', $shortUrl->destination_url);
}

/** @test */
public function track_visits_flag_is_set_from_the_config_if_it_is_not_explicitly_set()
{
Expand Down

0 comments on commit 5bb436d

Please sign in to comment.