Skip to content

Commit

Permalink
Delete X-Cascade header for default behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Feb 20, 2013
1 parent 6c42b31 commit 6b2e0cb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Next Release
============

* [#340](https://github.com/intridea/grape/pull/339): Allow rack/mount cascading to be skipped on header - [@dieb](https://github.com/dieb).
* [#340](https://github.com/intridea/grape/pull/339), [#342](https://github.com/intridea/grape/pull/342): Added `:cascade` option to `version` to allow disabling of rack/mount cascade behavior - [@dieb](https://github.com/dieb).
* [#333](https://github.com/intridea/grape/pull/333): Validation for array in params - [@flyerhzm](https://github.com/flyerhzm).
* [#306](https://github.com/intridea/grape/issues/306): Added I18n support for all Grape exceptions - [@niedhui](https://github.com/niedhui).
* [#294](https://github.com/intridea/grape/issues/294): Extracted `Grape::Entity` into a [grape-entity](https://github.com/agileanimal/grape-entity) gem - [@agileanimal](https://github.com/agileanimal).
Expand Down
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ end

When mounted inside Rails 3.x, errors like "404 Not Found" or "406 Not Acceptable" will likely be
handled and rendered by Rails handlers. For instance, accessing a nonexistent route "/api/foo"
raises a 404, which inside rails will ultimately be translated to a ActionController::RoutingError,
raises a 404, which inside rails will ultimately be translated to an `ActionController::RoutingError`,
which most likely will get rendered to a HTML error page.

Most APIs will enjoy avoiding Rails exceptions and have their own exceptions reaching the client.
Expand Down
4 changes: 2 additions & 2 deletions lib/grape/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,8 @@ def initialize

def call(env)
status, headers, body = @route_set.call(env)
headers['X-Cascade'] = '' unless cascade?
[status, headers, body]
headers.delete('X-Cascade') unless cascade?
[ status, headers, body ]
end

# Some requests may return a HTTP 404 error if grape cannot find a matching
Expand Down
2 changes: 1 addition & 1 deletion spec/grape/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ def serializable_hash
subject.version 'v2', :using => :path, :cascade => false
get "/v2/hello"
last_response.status.should == 404
last_response.headers["X-Cascade"].should == ""
last_response.headers.keys.should_not include "X-Cascade"
end
end
end

0 comments on commit 6b2e0cb

Please sign in to comment.