Skip to content

Commit

Permalink
allow delete requests to have bodies
Browse files Browse the repository at this point in the history
Fixes #219
  • Loading branch information
azylman authored and Alex Zylman committed Jan 20, 2016
1 parent 8c8d734 commit f4a2460
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion request.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
// CanHaveBody returns true if this method can have a body
func CanHaveBody(method string) bool {
mn := strings.ToUpper(method)
return mn == "POST" || mn == "PUT" || mn == "PATCH"
return mn == "POST" || mn == "PUT" || mn == "PATCH" || mn == "DELETE"
}

// JSONRequest creates a new http request with json headers set
Expand Down
2 changes: 1 addition & 1 deletion request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ func TestCanHaveBody(t *testing.T) {
assert.True(t, CanHaveBody("put"))
assert.True(t, CanHaveBody("post"))
assert.True(t, CanHaveBody("patch"))
assert.True(t, CanHaveBody("delete"))
assert.False(t, CanHaveBody(""))
assert.False(t, CanHaveBody("get"))
assert.False(t, CanHaveBody("options"))
assert.False(t, CanHaveBody("head"))
assert.False(t, CanHaveBody("delete"))
assert.False(t, CanHaveBody("invalid"))
}

Expand Down

0 comments on commit f4a2460

Please sign in to comment.