Implement micropub update support with clean exception-based error handling
- Add MicropubUnsupportedModelException for non-note update attempts - Refactor UpdateHandler to throw exceptions instead of returning JsonResponse objects; extract applySyndication() to DRY up duplicated syndication URL mapping - Fix MicropubController: InvalidTokenScopeException now returns 401 + insufficient_scope; add catches for ModelNotFoundException (404) and MicropubUnsupportedModelException (500); updates return 200 not 201 - Slim MicropubRequest.normalizeMicropubJson() to branch on action type, keeping update and create fields cleanly separated - Update tests to match corrected status codes and error keys; remove markTestSkipped() from all update tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a342b432d4
commit
24cb6d61aa
6 changed files with 93 additions and 95 deletions
|
|
@ -7,6 +7,7 @@ namespace App\Providers;
|
|||
use App\Services\Micropub\CardHandler;
|
||||
use App\Services\Micropub\EntryHandler;
|
||||
use App\Services\Micropub\MicropubHandlerRegistry;
|
||||
use App\Services\Micropub\UpdateHandler;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class MicropubServiceProvider extends ServiceProvider
|
||||
|
|
@ -19,6 +20,7 @@ class MicropubServiceProvider extends ServiceProvider
|
|||
// Register handlers
|
||||
$registry->register('card', new CardHandler);
|
||||
$registry->register('entry', new EntryHandler);
|
||||
$registry->register('update', new UpdateHandler);
|
||||
|
||||
return $registry;
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue