From 5f6d50bff1b4098bc0ef3c120e7b12104e5c4894 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 31 Mar 2017 09:56:20 -0400 Subject: Use 201 status code where appropriate for APIv4 (#5903) --- api4/apitestlib.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'api4/apitestlib.go') diff --git a/api4/apitestlib.go b/api4/apitestlib.go index 749053271..863237367 100644 --- a/api4/apitestlib.go +++ b/api4/apitestlib.go @@ -442,6 +442,15 @@ func CheckNoError(t *testing.T, resp *model.Response) { } } +func CheckCreatedStatus(t *testing.T, resp *model.Response) { + if resp.StatusCode != http.StatusCreated { + debug.PrintStack() + t.Log("actual: " + strconv.Itoa(resp.StatusCode)) + t.Log("expected: " + strconv.Itoa(http.StatusCreated)) + t.Fatal("wrong status code") + } +} + func CheckForbiddenStatus(t *testing.T, resp *model.Response) { if resp.Error == nil { debug.PrintStack() -- cgit v1.2.3-1-g7c22