Added /api => /api/docs redirect for convenience.

This commit is contained in:
Dan Brown 2021-11-14 15:20:04 +00:00
parent 7025cb38df
commit 2051189921
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
2 changed files with 7 additions and 0 deletions

View File

@ -42,6 +42,7 @@ Route::middleware('auth')->group(function () {
->where('path', '.*$');
// API docs routes
Route::redirect('/api', '/api/docs');
Route::get('/api/docs', [Api\ApiDocsController::class, 'display']);
Route::get('/pages/recently-updated', [PageController::class, 'showRecentlyUpdated']);

View File

@ -10,6 +10,12 @@ class ApiDocsTest extends TestCase
protected $endpoint = '/api/docs';
public function test_api_endpoint_redirects_to_docs()
{
$resp = $this->actingAsApiEditor()->get('/api');
$resp->assertRedirect('api/docs');
}
public function test_docs_page_returns_view_with_docs_content()
{
$resp = $this->actingAsApiEditor()->get($this->endpoint);