Skip to content

Commit

Permalink
Add a section to UPGRADING.md describing the new DELETE status code b…
Browse files Browse the repository at this point in the history
…ehaviour and how it’s changed over the past few versions
  • Loading branch information
jthornec committed Jan 4, 2017
1 parent d71a7b0 commit a758d45
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions UPGRADING.md
@@ -1,6 +1,36 @@
Upgrading Grape
===============

### Upgrading to >= 0.19.1 (next)

#### DELETE now defaults to status code 200 for responses with a body, or 204 otherwise

DELETE responses now use a 200 status code by default when a body is present, or 204 otherwise.

- In versions < 0.19.0, all DELETE requests defaulted to a 200 OK status code.
- In version 0.19.0, all DELETE requests defaulted to a 204 No Content status code, even when content was included in the response.
- As of version 0.19.1, DELETE requests default to a 204 No Content status code, unless content is supplied, in which case they default to a 200 OK status code.

To achieve the old behavior, one can specify the status code explicitly:

```ruby
delete :id do
status 204 # or 200, for < 0.19.0 behavior
'foo successfully deleted'
end
```

One can also use the new `return_no_content` helper to explicitly return 204 and an empty body for any request type:

```ruby
delete :id do
return_no_content
'this will not be returned'
end
```

See [#1550](https://github.com/ruby-grape/grape/pull/1550) for more information.

### Upgrading to >= 0.18.1

#### Changes in priority of :any routes
Expand Down

0 comments on commit a758d45

Please sign in to comment.