404 on get returns empty object and right status

This commit is contained in:
Bel LaPointe
2020-07-24 15:18:28 -06:00
parent 5aa121a42e
commit 887e67bc7d
2 changed files with 45 additions and 2 deletions

View File

@@ -53,8 +53,8 @@ func whoGet(namespace string, g storage.Graph, w http.ResponseWriter, r *http.Re
return err
}
if len(ones) == 0 {
http.NotFound(w, r)
return nil
w.WriteHeader(http.StatusNotFound)
return json.NewEncoder(w).Encode(entity.One{})
}
if len(ones) > 1 {
return errors.New("more than one result found matching " + id)