Add Indieweb related link to the HTTP headers

This commit is contained in:
Jonny Barnes 2024-06-08 19:39:09 +01:00
parent 7f70f75d05
commit 58b31bb4c1
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
6 changed files with 47 additions and 28 deletions

View file

@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace Tests\Feature;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class HeaderLinkTest extends TestCase
{
#[Test]
public function itShouldSeeTheIndiewebRelatedLinkHeaders(): void
{
$response = $this->get('/');
$linkHeaders = $response->headers->allPreserveCaseWithoutCookies()['Link'];
$this->assertSame('<' . config('app.url') . '/.well-known/indieauth-server>; rel="indieauth-metadata"', $linkHeaders[0]);
$this->assertSame('<' . config('app.url') . '/auth>; rel="authorization_endpoint"', $linkHeaders[1]);
$this->assertSame('<' . config('app.url') . '/token>; rel="token_endpoint"', $linkHeaders[2]);
$this->assertSame('<' . config('app.url') . '/api/post>; rel="micropub"', $linkHeaders[3]);
$this->assertSame('<' . config('app.url') . '/webmention>; rel="webmention"', $linkHeaders[4]);
}
}