Fixed up a couple of incorrect response codes (#1095)

* Fixed up a couple of incorrect response codes

* Standardise all entities on 204 with no return content on successful delete

* Fix failing Fn.delete() test
This commit is contained in:
Rik Gibson
2018-06-26 18:17:47 +01:00
committed by GitHub
parent ad026eb645
commit 64fb6d27b4
4 changed files with 6 additions and 6 deletions

View File

@@ -18,5 +18,5 @@ func (s *Server) handleFnDelete(c *gin.Context) {
return
}
c.JSON(http.StatusOK, gin.H{"message": "Successfully deleted func"})
c.String(http.StatusNoContent, "")
}

View File

@@ -155,7 +155,7 @@ func TestFnDelete(t *testing.T) {
expectedError error
}{
{commonDS, logs.NewMock(), "/v2/fns/missing", "", http.StatusNotFound, models.ErrFnsNotFound},
{commonDS, logs.NewMock(), fmt.Sprintf("/v2/fns/%s", f.ID), "", http.StatusOK, nil},
{commonDS, logs.NewMock(), fmt.Sprintf("/v2/fns/%s", f.ID), "", http.StatusNoContent, nil},
} {
rnr, cancel := testRunner(t)
srv := testServer(test.ds, &mqs.Mock{}, test.logDB, rnr, ServerTypeFull)

View File

@@ -16,5 +16,5 @@ func (s *Server) handleTriggerDelete(c *gin.Context) {
return
}
c.JSON(http.StatusNoContent, nil)
c.String(http.StatusNoContent, "")
}