Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix API status code for hook creation #2814

Merged
merged 2 commits into from
Nov 20, 2017
Merged

Conversation

ethantkoenig
Copy link
Member

Return 201, instead of 200, when creating a hook via the API; this is in compliance with the Github API, and more generally the semantics of HTTP status codes. Affects the following routes:

  • POST /:owner/:repo/hooks
  • POST /orgs/:org/hooks

@lunny lunny added the type/enhancement An improvement of existing functionality label Nov 1, 2017
@lunny lunny added this to the 1.3.0 milestone Nov 1, 2017
@codecov-io
Copy link

codecov-io commented Nov 1, 2017

Codecov Report

Merging #2814 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2814      +/-   ##
==========================================
- Coverage   27.26%   27.24%   -0.02%     
==========================================
  Files          89       89              
  Lines       17640    17640              
==========================================
- Hits         4809     4806       -3     
- Misses      12144    12146       +2     
- Partials      687      688       +1
Impacted Files Coverage Δ
modules/process/manager.go 69.56% <0%> (-4.35%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 061f65f...6a01664. Read the comment docs.

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 1, 2017
@lunny lunny added the pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! label Nov 1, 2017
@@ -69,7 +69,7 @@ func AddOrgHook(ctx *context.APIContext, form *api.CreateHookOption) {
org := ctx.Org.Organization
hook, ok := addHook(ctx, form, org.ID, 0)
if ok {
ctx.JSON(200, convert.ToHook(org.HomeLink(), hook))
ctx.JSON(201, convert.ToHook(org.HomeLink(), hook))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe change to http.StatusCreated for readable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

@appleboy appleboy Nov 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done? I don't see any changes for this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, the changes were lost when I rebased. I've readded the lost changes

@lafriks
Copy link
Member

lafriks commented Nov 1, 2017

@ethantkoenig please also regenerate swagger.json file

@ethantkoenig
Copy link
Member Author

@lafriks Done

@ethantkoenig
Copy link
Member Author

Rebased to rerun CI

@lafriks
Copy link
Member

lafriks commented Nov 1, 2017

@ethantkoenig fmt error

@lafriks
Copy link
Member

lafriks commented Nov 3, 2017

Need to verify that Jenkins & Drone plugins are not affected by this

@lunny lunny modified the milestones: 1.3.0, 1.4.0 Nov 10, 2017
@ethantkoenig
Copy link
Member Author

@lafriks I checked, and neither plugin will be broken. The drone plugin uses the sdk, and the Jenkins plugin checks for a 2xx response.

@lafriks
Copy link
Member

lafriks commented Nov 19, 2017

Thanks than LGTM

@tboerger tboerger added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 19, 2017
@appleboy
Copy link
Member

LGTM

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 20, 2017
@lunny lunny merged commit 876bafb into go-gitea:master Nov 20, 2017
@ethantkoenig ethantkoenig deleted the fix/hook_api branch December 18, 2017 06:08
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. pr/breaking Merging this PR means builds will break. Needs a description what exactly breaks, and how to fix it! type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants