In case of Etag cache hit, the body should be empty
This commit is contained in:
parent
847b9c8232
commit
751dae58e6
2 changed files with 7 additions and 1 deletions
|
@ -69,7 +69,7 @@ module Gitlab
|
|||
|
||||
status_code = Gitlab::PollingInterval.polling_enabled? ? 304 : 429
|
||||
|
||||
[status_code, { 'ETag' => etag }, ['']]
|
||||
[status_code, { 'ETag' => etag }, []]
|
||||
end
|
||||
|
||||
def track_cache_miss(if_none_match, cached_value_present, route)
|
||||
|
|
|
@ -91,6 +91,12 @@ describe Gitlab::EtagCaching::Middleware do
|
|||
expect(status).to eq 304
|
||||
end
|
||||
|
||||
it 'returns empty body' do
|
||||
_, _, body = middleware.call(build_env(path, if_none_match))
|
||||
|
||||
expect(body).to be_empty
|
||||
end
|
||||
|
||||
it 'tracks "etag_caching_cache_hit" event' do
|
||||
expect(Gitlab::Metrics).to receive(:add_event)
|
||||
.with(:etag_caching_middleware_used, endpoint: 'issue_notes')
|
||||
|
|
Loading…
Reference in a new issue