Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use https by default #53

Merged
merged 1 commit into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Imgix/UrlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class UrlBuilder {
// constants cannot be dynamically assigned; keeping as a class variable instead
private $targetWidths;

public function __construct($domain, $useHttps = false, $signKey = "", $includeLibraryParam = true) {
public function __construct($domain, $useHttps = true, $signKey = "", $includeLibraryParam = true) {

if (!is_string($domain)) {
throw new \InvalidArgumentException("UrlBuilder must be passed a string domain");
Expand Down
13 changes: 13 additions & 0 deletions tests/Imgix/Tests/UrlBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ public function testExamplePlain() {
$this->assertEquals("http://demos.imgix.net/bridge.png?h=100&w=100", $url);
}

public function testExamplePlainUsesHttpsByDefault() {
// Test default `UrlBuilder` uses https by default.
// Construct the builder with a `$domain` __only__.
$builder = new UrlBuilder("demos.imgix.net");
// Use `setIncludeLibraryParam`.
$builder->setIncludeLibraryParam(false);
// Construct a url in accordance with the other tests.
$params = array("w" => 100, "h" => 100);
// Create the url with the specified `$path` and `$params`.
$url = $builder->createURL("bridge.png", $params);
$this->assertEquals("https://demos.imgix.net/bridge.png?h=100&w=100", $url);
}

public function testExamplePlainHttps() {
$builder = new UrlBuilder("demos.imgix.net", false, "", false);

Expand Down