stable

Clone or download

Read-only

feat: Restler error response

Part of story #31173 register a new passkey This commit introduce class ErrorResponseBuilder which help to build error response in Restler format. If you create a API route but out of common API format (ie DispatchablePSR15Compatible), you cannot throw RestException in goal to send an error response. *Testing:* Fetch POST /webauthn/registration with error case (can be found in PostRegistrationControllerTest), it will return an error response in this format : { "error": { "code": int, "message": string } } Change-Id: If089822d94741e7dfb5ccb370432886e0eee848b

Modified Files

Name
A src/common/Http/Response/RestlerErrorResponseBuilder.php +51 −0 Go to diff View file
M src/common/Request/RouteCollector.php +10 −4 Go to diff View file
M src/common/WebAuthn/Controllers/PostRegistrationChallengeController.php +3 −3 Go to diff View file
M src/common/WebAuthn/Controllers/PostRegistrationController.php +12 −10 Go to diff View file
A tests/unit/common/Http/Response/RestlerErrorResponseBuilderTest.php +70 −0 Go to diff View file
M tests/unit/common/WebAuthn/Controllers/PostRegistrationChallengeControllerTest.php +5 −2 Go to diff View file
M tests/unit/common/WebAuthn/Controllers/PostRegistrationControllerTest.php +6 −14 Go to diff View file