Create ErrorResponse class for error handling#13
Merged
Conversation
Contributor
kduma
commented
Nov 23, 2025
- Create ErrorResponse class implementing Illuminate\Contracts\Support\Responsable
- Replace errorResponse() and jsonErrorResponse() methods with unified ErrorResponse
- ErrorResponse automatically detects JSON vs HTML requests using wantsJson()
- Remove deprecated error response helper methods from SDMController
- Create ErrorResponse class implementing Illuminate\Contracts\Support\Responsable - Replace errorResponse() and jsonErrorResponse() methods with unified ErrorResponse - ErrorResponse automatically detects JSON vs HTML requests using wantsJson() - Remove deprecated error response helper methods from SDMController
|
Coverage report for commit: e8b4f9f Summary - Lines: 100.00% | Methods: 100.00%
🤖 comment via lucassabreu/comment-coverage-clover |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Create ForceJsonResponseMiddleware to force JSON responses - Middleware sets Accept header to application/json for all API routes - Create routes/api.php for API endpoints - Move API routes from web.php to api.php - Register API routes with /api prefix in bootstrap/app.php - Apply ForceJsonResponseMiddleware to all API routes - API routes now automatically return JSON via wantsJson()
- Create ValidResponse class implementing Responsable
- Automatically converts data format based on request type:
* JSON: converts binary fields to hex, keeps snake_case keys
* HTML: converts keys to camelCase, keeps binary as-is
- Replace all view('info', ...) calls with ValidResponse
- Replace all jsonResponse(...) calls with ValidResponse
- Remove jsonResponse() helper method
- Remove JsonResponse import (no longer needed)
- Update return type hints to allow Responsable returns
- Unify data preparation using snake_case format with binary data
- Replace Route::get with Route::view for main page and WebNFC - Remove index() and webnfc() controller methods - Remove unused Illuminate\View\View import
- Remove apiTagPlainText, apiTag, apiTagTamper methods - Remove processEncryptedTagApi method - Update API routes to use the same controller methods as web routes - ValidResponse automatically handles JSON vs HTML based on request - Simplifies controller by removing duplicate code
- Create BaseSDMController with shared SDM methods * getSDM(), getMasterKey(), getEncKey(), getMacKey() - Create TagPlainTextController (invokable) for plain SUN validation - Create TagController (invokable) for encrypted SUN decryption * Includes convertToUtf8() method * Protected isTamperTag() method for extension - Create TagTamperController extending TagController * Overrides isTamperTag() to return true - Update routes to use invokable controllers (ControllerClass::class) - Remove old monolithic SDMController - Each controller is focused on a single responsibility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.