From 20511899214f084732f90df7f0adb36be16c7714 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 14 Nov 2021 15:20:04 +0000 Subject: [PATCH] Added /api => /api/docs redirect for convenience. --- routes/web.php | 1 + tests/Api/ApiDocsTest.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/routes/web.php b/routes/web.php index 854ec2337..653b5c227 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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']); diff --git a/tests/Api/ApiDocsTest.php b/tests/Api/ApiDocsTest.php index 062adce53..56b09cfb8 100644 --- a/tests/Api/ApiDocsTest.php +++ b/tests/Api/ApiDocsTest.php @@ -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);