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

Set Cache-Control only for streamed responses #2088

Merged
merged 1 commit into from
Jul 13, 2020

Conversation

stanhu
Copy link
Contributor

@stanhu stanhu commented Jul 10, 2020

The pull request #1520 introduced a regression that always caused the
Cache-Control HTTP header to be set to no-cache, even if the
response wasn't a stream. To fix this, we only set HTTP headers if there
is an actual stream.

Closes #2087

lib/grape/dsl/inside_route.rb Outdated Show resolved Hide resolved
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does fix a bug, but the specs don't cover that scenario I think.

lib/grape/dsl/inside_route.rb Show resolved Hide resolved
@stanhu stanhu force-pushed the sh-fix-issue-2087 branch 2 times, most recently from 907fbee to 946e641 Compare July 13, 2020 14:34
The pull request ruby-grape#1520 introduced a regression that always caused the
`Cache-Control` HTTP header to be set to `no-cache`, even if the
response wasn't a stream. To fix this, we only set HTTP headers if there
is an actual stream.

Closes ruby-grape#2087
@dblock dblock merged commit 0a346fb into ruby-grape:master Jul 13, 2020
jsugarman added a commit to ministryofjustice/Claim-for-Crown-Court-Defence that referenced this pull request Oct 9, 2020
version 1.4 broke Cache-Control that we rely on
see ruby-grape/grape#2088

Full [Change log](https://github.com/ruby-grape/grape/blob/master/CHANGELOG.md)
jsugarman added a commit to ministryofjustice/Claim-for-Crown-Court-Defence that referenced this pull request Oct 12, 2020
version 1.4 broke Cache-Control that we rely on
see ruby-grape/grape#2088

Full [Change log](https://github.com/ruby-grape/grape/blob/master/CHANGELOG.md)
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.

Grape v1.4.0 regression: Cache-Control is always set to no-cache
2 participants