BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
4ca3f647
Commit
4ca3f647
authored
Aug 18, 2014
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix labels return code
parent
27cf081e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
16 deletions
+15
-16
labels.md
doc/api/labels.md
+5
-6
labels.rb
lib/api/labels.rb
+2
-2
labels_spec.rb
spec/requests/api/labels_spec.rb
+8
-8
No files found.
doc/api/labels.md
View file @
4ca3f647
...
...
@@ -45,7 +45,7 @@ Parameters:
It returns 200 and the newly created label, if the operation succeeds.
If the label already exists, 409 and an error message is returned.
If label parameters are invalid, 40
5
and an explaining error message is returned.
If label parameters are invalid, 40
0
and an explaining error message is returned.
## Delete a label
...
...
@@ -58,8 +58,8 @@ DELETE /projects/:id/labels
-
`id`
(required) - The ID of a project
-
`name`
(required) - The name of the label to be deleted
It returns 200 if the label successfully was deleted, 40
4
for wrong parameters
and 40
0
if the label does not exist.
It returns 200 if the label successfully was deleted, 40
0
for wrong parameters
and 40
4
if the label does not exist.
In case of an error, additionally an error message is returned.
## Edit an existing label
...
...
@@ -79,7 +79,6 @@ Parameters:
-
`color`
(optional) - New color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB)
On success, this method returns 200 with the updated label.
If required parameters are missing, 400 is returned.
If required parameters are missing
or parameters are invalid
, 400 is returned.
If the label to be updated is missing, 404 is returned.
If parameters are invalid, 405 is returned. In case of an error,
additionally an error message is returned.
In case of an error, additionally an error message is returned.
lib/api/labels.rb
View file @
4ca3f647
...
...
@@ -38,7 +38,7 @@ module API
if
label
.
valid?
present
label
,
with:
Entities
::
Label
else
render_api_error!
(
label
.
errors
.
full_messages
.
join
(
', '
),
40
5
)
render_api_error!
(
label
.
errors
.
full_messages
.
join
(
', '
),
40
0
)
end
end
...
...
@@ -92,7 +92,7 @@ module API
if
label
.
update
(
attrs
)
present
label
,
with:
Entities
::
Label
else
render_api_error!
(
label
.
errors
.
full_messages
.
join
(
', '
),
40
5
)
render_api_error!
(
label
.
errors
.
full_messages
.
join
(
', '
),
40
0
)
end
end
end
...
...
spec/requests/api/labels_spec.rb
View file @
4ca3f647
...
...
@@ -42,19 +42,19 @@ describe API::API, api: true do
response
.
status
.
should
==
400
end
it
'should return 40
5
for invalid color'
do
it
'should return 40
0
for invalid color'
do
post
api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
),
name:
'Foo'
,
color:
'#FFAA'
response
.
status
.
should
==
40
5
response
.
status
.
should
==
40
0
json_response
[
'message'
].
should
==
'Color is invalid'
end
it
'should return 40
5
for invalid name'
do
it
'should return 40
0
for invalid name'
do
post
api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
),
name:
'?'
,
color:
'#FFAABB'
response
.
status
.
should
==
40
5
response
.
status
.
should
==
40
0
json_response
[
'message'
].
should
==
'Title is invalid'
end
...
...
@@ -131,20 +131,20 @@ describe API::API, api: true do
response
.
status
.
should
==
400
end
it
'should return 40
5
for invalid name'
do
it
'should return 40
0
for invalid name'
do
put
api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
),
name:
'label1'
,
new_name:
'?'
,
color:
'#FFFFFF'
response
.
status
.
should
==
40
5
response
.
status
.
should
==
40
0
json_response
[
'message'
].
should
==
'Title is invalid'
end
it
'should return 40
5
for invalid name'
do
it
'should return 40
0
for invalid name'
do
put
api
(
"/projects/
#{
project
.
id
}
/labels"
,
user
),
name:
'label1'
,
color:
'#FF'
response
.
status
.
should
==
40
5
response
.
status
.
should
==
40
0
json_response
[
'message'
].
should
==
'Color is invalid'
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