Skip to content

Commit a758d45

Browse files
committed
Add a section to UPGRADING.md describing the new DELETE status code behaviour and how it’s changed over the past few versions
1 parent d71a7b0 commit a758d45

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

UPGRADING.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
11
Upgrading Grape
22
===============
33

4+
### Upgrading to >= 0.19.1 (next)
5+
6+
#### DELETE now defaults to status code 200 for responses with a body, or 204 otherwise
7+
8+
DELETE responses now use a 200 status code by default when a body is present, or 204 otherwise.
9+
10+
- In versions < 0.19.0, all DELETE requests defaulted to a 200 OK status code.
11+
- In version 0.19.0, all DELETE requests defaulted to a 204 No Content status code, even when content was included in the response.
12+
- 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.
13+
14+
To achieve the old behavior, one can specify the status code explicitly:
15+
16+
```ruby
17+
delete :id do
18+
status 204 # or 200, for < 0.19.0 behavior
19+
'foo successfully deleted'
20+
end
21+
```
22+
23+
One can also use the new `return_no_content` helper to explicitly return 204 and an empty body for any request type:
24+
25+
```ruby
26+
delete :id do
27+
return_no_content
28+
'this will not be returned'
29+
end
30+
```
31+
32+
See [#1550](https://github.com/ruby-grape/grape/pull/1550) for more information.
33+
434
### Upgrading to >= 0.18.1
535

636
#### Changes in priority of :any routes

0 commit comments

Comments
 (0)