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
630efe48
Commit
630efe48
authored
Aug 15, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
bb96e92c
36a729f0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
11 deletions
+29
-11
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+5
-1
changelogs/unreleased/georgekoltsov-48854-fix-empty-flash-message.yml
...nreleased/georgekoltsov-48854-fix-empty-flash-message.yml
+6
-0
spec/controllers/application_controller_spec.rb
spec/controllers/application_controller_spec.rb
+18
-10
No files found.
app/controllers/application_controller.rb
View file @
630efe48
...
...
@@ -116,7 +116,7 @@ class ApplicationController < ActionController::Base
def
render
(
*
args
)
super
.
tap
do
# Set a header for custom error pages to prevent them from being intercepted by gitlab-workhorse
if
response
.
content_type
==
'text/html'
&&
(
400
..
599
).
cover?
(
response
.
status
)
if
(
400
..
599
).
cover?
(
response
.
status
)
&&
workhorse_excluded_content_types
.
include?
(
response
.
content_type
)
response
.
headers
[
'X-GitLab-Custom-Error'
]
=
'1'
end
end
...
...
@@ -124,6 +124,10 @@ class ApplicationController < ActionController::Base
protected
def
workhorse_excluded_content_types
@workhorse_excluded_content_types
||=
%w(text/html application/json)
end
def
append_info_to_payload
(
payload
)
super
...
...
changelogs/unreleased/georgekoltsov-48854-fix-empty-flash-message.yml
0 → 100644
View file @
630efe48
---
title
:
Fix empty error flash message on profile:account page when updating username
with username that has already been taken
merge_request
:
31809
author
:
type
:
fixed
spec/controllers/application_controller_spec.rb
View file @
630efe48
...
...
@@ -641,24 +641,32 @@ describe ApplicationController do
end
end
it
'
does not set
a custom header'
do
it
'
sets
a custom header'
do
get
:index
,
format: :json
expect
(
response
.
headers
[
'X-GitLab-Custom-Error'
]).
to
be_nil
expect
(
response
.
headers
[
'X-GitLab-Custom-Error'
]).
to
eq
'1'
end
end
context
'given a json response for an html request'
do
controller
do
def
index
render
json:
{},
status: :unprocessable_entity
context
'for html request'
do
it
'sets a custom header'
do
get
:index
expect
(
response
.
headers
[
'X-GitLab-Custom-Error'
]).
to
eq
'1'
end
end
it
'does not set a custom header'
do
get
:index
context
'for 200 response'
do
controller
do
def
index
render
json:
{},
status: :ok
end
end
expect
(
response
.
headers
[
'X-GitLab-Custom-Error'
]).
to
be_nil
it
'does not set a custom header'
do
get
:index
,
format: :json
expect
(
response
.
headers
[
'X-GitLab-Custom-Error'
]).
to
be_nil
end
end
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