Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend :cascade to work with all versioning strategies #342

Merged
merged 1 commit into from
Feb 20, 2013
Merged

Extend :cascade to work with all versioning strategies #342

merged 1 commit into from
Feb 20, 2013

Conversation

dieb
Copy link
Contributor

@dieb dieb commented Feb 20, 2013

The :cascade option allows preventing X-Cascade to be returned on
response headers. For Rails users, this is useful because your
API exceptions don't get rendered/handled by Rails, but actually sent to
users. This is particularly useful if you want your user to receive an
error exception in the same format your API supports, and not an
unexpected HTML page.

A more in-depth explanation of :cascade was moved into the code and the
overview was inserted on the main README on the exceptions section.

This commit also changes the order in which versioning strategies are
presented. The order is now consistent with the order in which the
strategies were first presented. It also presents the default one,
before introducing non-defaults.

The :cascade option allows preventing X-Cascade to be returned on
response headers. For Rails users, this is useful because your
API exceptions don't get rendered/handled by Rails, but actually sent to
users. This is particularly useful if you want your user to receive an
error exception in the same format your API supports, and not an
unexpected HTML page.

A more in-depth explanation of :cascade was moved into the code and the
overview was inserted on the main README on the exceptions section.

This commit also changes the order in which versioning strategies are
presented. The order is now consistent with the order in which the
strategies were first presented. It also presents the default one,
before introducing non-defaults.
@dieb
Copy link
Contributor Author

dieb commented Feb 20, 2013

As noted on #340, mounting Grape inside rails will likely get exceptions rendered by rails, which for some users may not be pleasant.

By setting :cascade => false, the API can now disable this behaviour for requests to the API path.

@dblock dblock merged commit 6c42b31 into ruby-grape:master Feb 20, 2013
@dblock
Copy link
Member

dblock commented Feb 20, 2013

I merged this with a small change: deleting the X-Cascade header instead of setting it to blank. If I understand this correctly, it has the same effect, but please correct me if I am wrong.

6b2e0cb

@dieb
Copy link
Contributor Author

dieb commented Feb 20, 2013

I first wrote is as deleting the header but for some reason I changed it to unsetting but I don't remember why :-( I'll try to remember. Hahaha

@dieb
Copy link
Contributor Author

dieb commented Feb 20, 2013

BTW Did you run rspec with the header deleted? It might break the second test case I prepared.

@dblock
Copy link
Member

dblock commented Feb 20, 2013

I did fix the test ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants