Return empty json if we don't have any protocols to return

This commit is contained in:
Till Faelligen 2022-11-28 10:04:03 +01:00
parent 31f56ac3f4
commit b30a2b7679
No known key found for this signature in database
GPG key ID: ACCDC9606D472758

View file

@ -36,9 +36,15 @@ func Protocols(req *http.Request, asAPI appserviceAPI.AppServiceInternalAPI, dev
return jsonerror.InternalServerError() return jsonerror.InternalServerError()
} }
if !resp.Exists { if !resp.Exists {
if protocol != "" {
return util.JSONResponse{
Code: http.StatusNotFound,
JSON: jsonerror.NotFound("The protocol is unknown."),
}
}
return util.JSONResponse{ return util.JSONResponse{
Code: http.StatusNotFound, Code: http.StatusOK,
JSON: jsonerror.NotFound("The protocol is unknown."), JSON: struct{}{},
} }
} }
if protocol != "" { if protocol != "" {