-
Notifications
You must be signed in to change notification settings - Fork 32
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
SO-4992: ETag and Cache-Control header support #1270
Conversation
This provides the most accurate ETag value that can be used for any kind of content request, be it versioned or not.
...when we build the response upon receiving a resolved/rejected promise. This prevents header duplication and hopefully overrides anything that Spring incorrectly adds by default.
Add it to AllSnomedApiTests suite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
...header handling
...promise body if the body is a Spring ResponseEntity instance
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 9.x #1270 +/- ##
============================================
+ Coverage 48.19% 48.21% +0.01%
- Complexity 13906 13922 +16
============================================
Files 1944 1946 +2
Lines 95081 95121 +40
Branches 10983 10985 +2
============================================
+ Hits 45822 45859 +37
+ Misses 46270 46267 -3
- Partials 2989 2995 +6 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RSLGTM!
public class RateLimitConfig { | ||
|
||
@Min(0) | ||
private long overdraft = 0L; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to see a simple one-sentence explanation about the purpose of these values. For future devs I think it would be extremely useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
...which replaces the `api.rate_limit.overdraft` config key Add some documentation references to ease understanding of how rate-limiting in Snow Owl works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
👌🏻 |
This PR adds support for
ETag
andCache-Control
headers so that HTTP clients, proxies, and intermediaries can cache the responses earlier than caching only in an HTTP browser.Still somewhat blocked by spring-projects/spring-security#12865. We need to figure out a way of preventing Spring from adding the default cache-control headers when we set our own.Resolved the above in the meantime by explicitly setting the headers in the response before Spring can write its defaults incorrectly.
Background: https://snowowl.atlassian.net/browse/SO-4992