Skip to content

Commit

Permalink
Merge pull request #17 from TheDragonCode/patch/2022-01-18/16-48
Browse files Browse the repository at this point in the history
Added `lmc/http-constants` package
  • Loading branch information
Andrey Helldar committed Jan 18, 2022
2 parents fc96187 + 56c6ecb commit 247d8da
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"illuminate/console": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"illuminate/database": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0",
"lmc/http-constants": "^1.2",
"nesbot/carbon": "^1.20 || ^2.0",
"psr/http-message": "^1.0.1"
},
Expand Down
3 changes: 2 additions & 1 deletion src/Services/Checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use DragonCode\LastModified\Concerns\Urlable;
use DragonCode\Support\Concerns\Makeable;
use Illuminate\Http\Request;
use Lmc\HttpConstants\Header;

/**
* @method static Checker make(Request $request = null)
Expand Down Expand Up @@ -83,7 +84,7 @@ protected function find(): ?DateTimeInterface

protected function modifiedSince()
{
return $this->request->headers->getDate('If-Modified-Since');
return $this->request->headers->getDate(Header::IF_MODIFIED_SINCE);
}

protected function doesntRequest(): bool
Expand Down
3 changes: 2 additions & 1 deletion tests/Concerns/Requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

use Carbon\Carbon;
use Illuminate\Http\Request;
use Lmc\HttpConstants\Header;

trait Requests
{
Expand All @@ -33,7 +34,7 @@ trait Requests
protected function request(string $url, Carbon $date = null)
{
if (! empty($date)) {
$this->withHeader('If-Modified-Since', $date->format('r'));
$this->withHeader(Header::IF_MODIFIED_SINCE, $date->format('r'));
}

return $this->get($url);
Expand Down

0 comments on commit 247d8da

Please sign in to comment.