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
Léo-Paul Géneau
gitlab-ce
Commits
8386edaf
Commit
8386edaf
authored
Jan 07, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept 2xx status codes for successful Web hook triggers
Closes
https://github.com/gitlabhq/gitlabhq/issues/9956
parent
61561a9e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletion
+14
-1
CHANGELOG
CHANGELOG
+1
-0
app/models/hooks/web_hook.rb
app/models/hooks/web_hook.rb
+1
-1
spec/models/hooks/web_hook_spec.rb
spec/models/hooks/web_hook_spec.rb
+12
-0
No files found.
CHANGELOG
View file @
8386edaf
Please view this file on the master branch, on stable branches it's out of date.
v 8.4.0 (unreleased)
- Accept 2xx status codes for successful Web hook triggers (Stan Hu)
- Fix missing date of month in network graph when commits span a month (Stan Hu)
- Expire view caches when application settings change (e.g. Gravatar disabled) (Stan Hu)
- Don't notify users twice if they are both project watchers and subscribers (Stan Hu)
...
...
app/models/hooks/web_hook.rb
View file @
8386edaf
...
...
@@ -60,7 +60,7 @@ class WebHook < ActiveRecord::Base
basic_auth:
auth
)
end
[
response
.
code
==
200
,
ActionView
::
Base
.
full_sanitizer
.
sanitize
(
response
.
to_s
)]
[
(
response
.
code
>=
200
&&
response
.
code
<
300
)
,
ActionView
::
Base
.
full_sanitizer
.
sanitize
(
response
.
to_s
)]
rescue
SocketError
,
OpenSSL
::
SSL
::
SSLError
,
Errno
::
ECONNRESET
,
Errno
::
ECONNREFUSED
,
Net
::
OpenTimeout
=>
e
logger
.
error
(
"WebHook Error =>
#{
e
}
"
)
[
false
,
e
.
to_s
]
...
...
spec/models/hooks/web_hook_spec.rb
View file @
8386edaf
...
...
@@ -77,5 +77,17 @@ describe ProjectHook, models: true do
expect
(
@project_hook
.
execute
(
@data
,
'push_hooks'
)).
to
eq
([
false
,
'SSL error'
])
end
it
"handles 200 status code"
do
WebMock
.
stub_request
(
:post
,
@project_hook
.
url
).
to_return
(
status:
200
,
body:
"Success"
)
expect
(
@project_hook
.
execute
(
@data
,
'push_hooks'
)).
to
eq
([
true
,
'Success'
])
end
it
"handles 2xx status codes"
do
WebMock
.
stub_request
(
:post
,
@project_hook
.
url
).
to_return
(
status:
201
,
body:
"Success"
)
expect
(
@project_hook
.
execute
(
@data
,
'push_hooks'
)).
to
eq
([
true
,
'Success'
])
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