Skip to content

Commit 7996660

Browse files
authored
Modifies Upgrading.MD for opening/closing Grape
Describes in more detail known impacts of the upgrade to `1.2.0` including what to do when opening / closing `Grape::API`
1 parent fadabec commit 7996660

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

UPGRADING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ with a class that can contain several instances of `Grape::API`.
1212
This changes were done in such a way that no code-changes should be required.
1313
However, if experiencing problems, or relying on private methods and internal behaviour too deeply, it is possible to restore the prior behaviour by replacing the references from `Grape::API` to `Grape::API::Instance`.
1414

15+
Note, this is particularly relevant if you are opening the class `Grape::API` for modification. This code:
16+
17+
```ruby
18+
class Grape::API
19+
#your patched logic
20+
...
21+
end
22+
```
23+
24+
Needs to be modified into:
25+
26+
```ruby
27+
class Grape::API::Instance
28+
#your patched logic
29+
...
30+
end
31+
```
32+
1533
#### Changes in rescue_from returned object
1634

1735
Grape will now check the object returned from `rescue_from` and ensure that it is a `Rack::Response`. That makes sure response is valid and avoids exposing service information. Change any code that invoked `Rack::Response.new(...).finish` in a custom `rescue_from` block to `Rack::Response.new(...)` to comply with the validation.

0 commit comments

Comments
 (0)