add err msg on PeeringRead not found (#12986)

Signed-off-by: FFMMM <FFMMM@users.noreply.github.com>

Co-authored-by: Freddy <freddygv@users.noreply.github.com>
This commit is contained in:
FFMMM 2022-05-09 15:22:42 -07:00 committed by GitHub
parent 37a1e33834
commit b8ce8e36fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -48,7 +48,7 @@ func (s *HTTPHandlers) peeringRead(resp http.ResponseWriter, req *http.Request,
return nil, err
}
if result.Peering == nil {
return nil, HTTPError{StatusCode: http.StatusNotFound}
return nil, HTTPError{StatusCode: http.StatusNotFound, Reason: fmt.Sprintf("Peering not found for %q", name)}
}
// TODO(peering): replace with API types

View File

@ -292,6 +292,7 @@ func TestHTTP_Peering_Read(t *testing.T) {
resp := httptest.NewRecorder()
a.srv.h.ServeHTTP(resp, req)
require.Equal(t, http.StatusNotFound, resp.Code)
require.Equal(t, "Peering not found for \"baz\"", resp.Body.String())
})
}