Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3ce94109
Commit
3ce94109
authored
Nov 10, 2020
by
Heinrich Lee Yu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "RawController respond with uncached headers"
This reverts commit
494c56ef
.
parent
1bb1b224
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
24 deletions
+9
-24
app/controllers/projects/raw_controller.rb
app/controllers/projects/raw_controller.rb
+0
-1
spec/controllers/projects/raw_controller_spec.rb
spec/controllers/projects/raw_controller_spec.rb
+0
-5
spec/requests/api/files_spec.rb
spec/requests/api/files_spec.rb
+9
-6
spec/support/shared_examples/cached_response_shared_examples.rb
...upport/shared_examples/cached_response_shared_examples.rb
+0
-12
No files found.
app/controllers/projects/raw_controller.rb
View file @
3ce94109
...
...
@@ -12,7 +12,6 @@ class Projects::RawController < Projects::ApplicationController
before_action
:authorize_download_code!
before_action
:show_rate_limit
,
only:
[
:show
],
unless: :external_storage_request?
before_action
:assign_ref_vars
before_action
:no_cache_headers
,
only:
[
:show
]
before_action
:redirect_to_external_storage
,
only: :show
,
if: :static_objects_external_storage_enabled?
feature_category
:source_code_management
...
...
spec/controllers/projects/raw_controller_spec.rb
View file @
3ce94109
...
...
@@ -33,11 +33,6 @@ RSpec.describe Projects::RawController do
it_behaves_like
'project cache control headers'
it_behaves_like
'content disposition headers'
it_behaves_like
'uncached response'
do
before
do
subject
end
end
end
context
'image header'
do
...
...
spec/requests/api/files_spec.rb
View file @
3ce94109
...
...
@@ -537,13 +537,16 @@ RSpec.describe API::Files do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
it_behaves_like
'uncached response'
do
before
do
url
=
route
(
'.gitignore'
)
+
"/raw"
expect
(
Gitlab
::
Workhorse
).
to
receive
(
:send_git_blob
)
it
'sets no-cache headers'
do
url
=
route
(
'.gitignore'
)
+
"/raw"
expect
(
Gitlab
::
Workhorse
).
to
receive
(
:send_git_blob
)
get
api
(
url
,
current_user
),
params:
params
end
get
api
(
url
,
current_user
),
params:
params
expect
(
response
.
headers
[
"Cache-Control"
]).
to
include
(
"no-store"
)
expect
(
response
.
headers
[
"Cache-Control"
]).
to
include
(
"no-cache"
)
expect
(
response
.
headers
[
"Pragma"
]).
to
eq
(
"no-cache"
)
expect
(
response
.
headers
[
"Expires"
]).
to
eq
(
"Fri, 01 Jan 1990 00:00:00 GMT"
)
end
context
'when mandatory params are not given'
do
...
...
spec/support/shared_examples/cached_response_shared_examples.rb
deleted
100644 → 0
View file @
1bb1b224
# frozen_string_literal: true
#
# Negates lib/gitlab/no_cache_headers.rb
#
RSpec
.
shared_examples
'cached response'
do
it
'defines a cached header response'
do
expect
(
response
.
headers
[
"Cache-Control"
]).
not_to
include
(
"no-store"
,
"no-cache"
)
expect
(
response
.
headers
[
"Pragma"
]).
not_to
eq
(
"no-cache"
)
expect
(
response
.
headers
[
"Expires"
]).
not_to
eq
(
"Fri, 01 Jan 1990 00:00:00 GMT"
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment