Use POST to create a new release instead of PUT
This commit is contained in:
parent
faef95af1a
commit
6f7e90f6db
3 changed files with 8 additions and 8 deletions
|
@ -84,13 +84,13 @@ It returns 200 if the operation succeed. In case of an error,
|
||||||
405 with an explaining error message is returned.
|
405 with an explaining error message is returned.
|
||||||
|
|
||||||
|
|
||||||
## New release
|
## Create a new release
|
||||||
|
|
||||||
Add release notes to the existing git tag. It returns 200 if the release is
|
Add release notes to the existing git tag. It returns 201 if the release is
|
||||||
created successfully. If the tag does not exist, 404 is returned.
|
created successfully. If the tag does not exist, 404 is returned.
|
||||||
|
|
||||||
```
|
```
|
||||||
PUT /projects/:id/repository/tags/:tag_name/release
|
POST /projects/:id/repository/tags/:tag_name/release
|
||||||
```
|
```
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
|
|
|
@ -48,7 +48,7 @@ module API
|
||||||
# description (required) - Release notes with markdown support
|
# description (required) - Release notes with markdown support
|
||||||
# Example Request:
|
# Example Request:
|
||||||
# PUT /projects/:id/repository/tags/:tag_name/release
|
# PUT /projects/:id/repository/tags/:tag_name/release
|
||||||
put ':id/repository/tags/:tag_name/release', requirements: { tag_name: /.*/ } do
|
post ':id/repository/tags/:tag_name/release', requirements: { tag_name: /.*/ } do
|
||||||
authorize_push_project
|
authorize_push_project
|
||||||
required_attributes! [:description]
|
required_attributes! [:description]
|
||||||
result = CreateReleaseService.new(user_project, current_user).
|
result = CreateReleaseService.new(user_project, current_user).
|
||||||
|
|
|
@ -119,21 +119,21 @@ describe API::API, api: true do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'PUT /projects/:id/repository/tags/:tag_name/release' do
|
describe 'POST /projects/:id/repository/tags/:tag_name/release' do
|
||||||
let(:tag_name) { project.repository.tag_names.first }
|
let(:tag_name) { project.repository.tag_names.first }
|
||||||
let(:description) { 'Awesome release!' }
|
let(:description) { 'Awesome release!' }
|
||||||
|
|
||||||
it 'should create description for existing git tag' do
|
it 'should create description for existing git tag' do
|
||||||
put api("/projects/#{project.id}/repository/tags/#{tag_name}/release", user),
|
post api("/projects/#{project.id}/repository/tags/#{tag_name}/release", user),
|
||||||
description: description
|
description: description
|
||||||
|
|
||||||
expect(response.status).to eq(200)
|
expect(response.status).to eq(201)
|
||||||
expect(json_response['tag_name']).to eq(tag_name)
|
expect(json_response['tag_name']).to eq(tag_name)
|
||||||
expect(json_response['description']).to eq(description)
|
expect(json_response['description']).to eq(description)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return 404 if the tag does not exist' do
|
it 'should return 404 if the tag does not exist' do
|
||||||
put api("/projects/#{project.id}/repository/tags/foobar/release", user),
|
post api("/projects/#{project.id}/repository/tags/foobar/release", user),
|
||||||
description: description
|
description: description
|
||||||
|
|
||||||
expect(response.status).to eq(404)
|
expect(response.status).to eq(404)
|
||||||
|
|
Loading…
Reference in a new issue