Skip to content

Commit 203525c

Browse files
committed
pr bug/rest-204 review feedback
1 parent b9f1b5d commit 203525c

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

api/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func (c Client) REST(method string, p string, body io.Reader, data interface{})
146146
return handleHTTPError(resp)
147147
}
148148

149-
if resp.StatusCode == http.StatusNoContent && resp.ContentLength == 0 {
149+
if resp.StatusCode == http.StatusNoContent {
150150
return nil
151151
}
152152

api/client_rest_test.go

Lines changed: 0 additions & 23 deletions
This file was deleted.

api/client_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,17 @@ func TestGraphQLError(t *testing.T) {
5050
t.Fatalf("got %q", err.Error())
5151
}
5252
}
53+
54+
func TestRESTGetDelete(t *testing.T) {
55+
http := &FakeHTTP{}
56+
57+
client := NewClient(
58+
ReplaceTripper(http),
59+
)
60+
61+
http.StubResponse(204, bytes.NewBuffer([]byte{}))
62+
63+
r := bytes.NewReader([]byte(`{}`))
64+
err := client.REST("DELETE", "applications/CLIENTID/grant", r, nil)
65+
eq(t, err, nil)
66+
}

0 commit comments

Comments
 (0)