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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
c28b0a53
Commit
c28b0a53
authored
Jan 04, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't instrument 405 Grape calls
Fixes #26051. Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
8ab94120
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
3 deletions
+25
-3
changelogs/unreleased/26051-fix-missing-endpoint-route-method.yml
...gs/unreleased/26051-fix-missing-endpoint-route-method.yml
+4
-0
lib/api/api.rb
lib/api/api.rb
+5
-1
lib/ci/api/api.rb
lib/ci/api/api.rb
+10
-0
lib/gitlab/metrics/rack_middleware.rb
lib/gitlab/metrics/rack_middleware.rb
+6
-2
No files found.
changelogs/unreleased/26051-fix-missing-endpoint-route-method.yml
0 → 100644
View file @
c28b0a53
---
title
:
Don't instrument 405 Grape calls
merge_request
:
8445
author
:
lib/api/api.rb
View file @
c28b0a53
...
...
@@ -14,7 +14,11 @@ module API
end
# Retain 405 error rather than a 500 error for Grape 0.15.0+.
# See: https://github.com/ruby-grape/grape/commit/252bfd27c320466ec3c0751812cf44245e97e5de
# https://github.com/ruby-grape/grape/blob/a3a28f5b5dfbb2797442e006dbffd750b27f2a76/UPGRADING.md#changes-to-method-not-allowed-routes
rescue_from
Grape
::
Exceptions
::
MethodNotAllowed
do
|
e
|
error!
e
.
message
,
e
.
status
,
e
.
headers
end
rescue_from
Grape
::
Exceptions
::
Base
do
|
e
|
error!
e
.
message
,
e
.
status
,
e
.
headers
end
...
...
lib/ci/api/api.rb
View file @
c28b0a53
...
...
@@ -8,6 +8,16 @@ module Ci
rack_response
({
'message'
=>
'404 Not found'
}.
to_json
,
404
)
end
# Retain 405 error rather than a 500 error for Grape 0.15.0+.
# https://github.com/ruby-grape/grape/blob/a3a28f5b5dfbb2797442e006dbffd750b27f2a76/UPGRADING.md#changes-to-method-not-allowed-routes
rescue_from
Grape
::
Exceptions
::
MethodNotAllowed
do
|
e
|
error!
e
.
message
,
e
.
status
,
e
.
headers
end
rescue_from
Grape
::
Exceptions
::
Base
do
|
e
|
error!
e
.
message
,
e
.
status
,
e
.
headers
end
rescue_from
:all
do
|
exception
|
handle_api_exception
(
exception
)
end
...
...
lib/gitlab/metrics/rack_middleware.rb
View file @
c28b0a53
...
...
@@ -70,9 +70,13 @@ module Gitlab
def
tag_endpoint
(
trans
,
env
)
endpoint
=
env
[
ENDPOINT_KEY
]
# endpoint.route is nil in the case of a 405 response
if
endpoint
.
route
path
=
endpoint_paths_cache
[
endpoint
.
route
.
request_method
][
endpoint
.
route
.
path
]
trans
.
action
=
"Grape#
#{
endpoint
.
route
.
request_method
}
#{
path
}
"
end
end
private
...
...
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