Commit c694a608 authored by Amy Troschinetz's avatar Amy Troschinetz

Create token response should be CREATED

parent 8013ec5b
...@@ -9,7 +9,7 @@ module Groups ...@@ -9,7 +9,7 @@ module Groups
deploy_token = create_deploy_token_for(@group, params) deploy_token = create_deploy_token_for(@group, params)
if deploy_token.persisted? if deploy_token.persisted?
success(deploy_token: deploy_token, http_status: :ok) success(deploy_token: deploy_token, http_status: :created)
else else
error(deploy_token.errors.full_messages.to_sentence, :bad_request) error(deploy_token.errors.full_messages.to_sentence, :bad_request)
end end
......
...@@ -9,7 +9,7 @@ module Projects ...@@ -9,7 +9,7 @@ module Projects
deploy_token = create_deploy_token_for(@project, params) deploy_token = create_deploy_token_for(@project, params)
if deploy_token.persisted? if deploy_token.persisted?
success(deploy_token: deploy_token, http_status: :ok) success(deploy_token: deploy_token, http_status: :created)
else else
error(deploy_token.errors.full_messages.to_sentence, :bad_request) error(deploy_token.errors.full_messages.to_sentence, :bad_request)
end end
......
---
title: Token creation uses HTTP status CREATED
merge_request: 28587
author:
type: fixed
...@@ -267,7 +267,7 @@ describe Groups::Settings::CiCdController do ...@@ -267,7 +267,7 @@ describe Groups::Settings::CiCdController do
it 'creates the deploy token' do it 'creates the deploy token' do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:created)
expect(response).to match_response_schema('public_api/v4/deploy_token') expect(response).to match_response_schema('public_api/v4/deploy_token')
expect(json_response).to match(expected_response) expect(json_response).to match(expected_response)
end end
......
...@@ -300,7 +300,7 @@ describe Projects::Settings::CiCdController do ...@@ -300,7 +300,7 @@ describe Projects::Settings::CiCdController do
it 'creates the deploy token' do it 'creates the deploy token' do
subject subject
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:created)
expect(response).to match_response_schema('public_api/v4/deploy_token') expect(response).to match_response_schema('public_api/v4/deploy_token')
expect(json_response).to match(expected_response) expect(json_response).to match(expected_response)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment