mirror of
https://github.com/Luzifer/ots.git
synced 2025-07-24 15:05:20 -04:00
Return 404 on not existent secret
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
9c81f9223f
commit
bcef1a1cce
2 changed files with 9 additions and 1 deletions
6
api.go
6
api.go
|
@ -60,7 +60,11 @@ func (a apiServer) handleRead(res http.ResponseWriter, r *http.Request) {
|
|||
|
||||
secret, err := a.store.ReadAndDestroy(id)
|
||||
if err != nil {
|
||||
a.jsonResponse(res, http.StatusInternalServerError, map[string]interface{}{
|
||||
status := http.StatusInternalServerError
|
||||
if err == errSecretNotFound {
|
||||
status = http.StatusNotFound
|
||||
}
|
||||
a.jsonResponse(res, status, map[string]interface{}{
|
||||
"success": false,
|
||||
"error": err.Error(),
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue