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

Updates to API 404 responses #6077

Merged
merged 22 commits into from
Mar 19, 2019
Merged

Conversation

jolheiser
Copy link
Member

This PR will address #6052

So far it handles API 404s.
Instead of a blank 404, it returns a JSON response with a message of "Not Found" and a documentation_url pointing to the basic swagger endpoint. e.g. https://try.gitea.io/api/swagger

@codecov-io
Copy link

codecov-io commented Feb 14, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@d10a668). Click here to learn what that means.
The diff coverage is 18.18%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #6077   +/-   ##
=========================================
  Coverage          ?   38.87%           
=========================================
  Files             ?      365           
  Lines             ?    51341           
  Branches          ?        0           
=========================================
  Hits              ?    19957           
  Misses            ?    28511           
  Partials          ?     2873
Impacted Files Coverage Δ
routers/api/v1/org/hook.go 0% <0%> (ø)
routers/api/v1/repo/release_attachment.go 0% <0%> (ø)
routers/api/v1/repo/release.go 44.94% <0%> (ø)
routers/api/v1/repo/issue_tracked_time.go 0% <0%> (ø)
routers/api/v1/repo/issue_label.go 29.52% <0%> (ø)
routers/api/v1/org/member.go 0% <0%> (ø)
routers/api/v1/repo/issue.go 23.46% <0%> (ø)
routers/api/v1/repo/hook.go 18.77% <0%> (ø)
routers/api/v1/user/star.go 0% <0%> (ø)
routers/api/v1/user/key.go 64.35% <0%> (ø)
... and 20 more

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 d10a668...2ce89fc. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 14, 2019
Copy link
Contributor

@zeripath zeripath left a comment

Choose a reason for hiding this comment

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

I'd prefer a path.Join in there instead of fmt.Sprintf

@lafriks
Copy link
Member

lafriks commented Feb 15, 2019

It should probably moved to some kind of helper method as all 404 errors (also ones returned from methods where record by id is not found etc) should return same imho

@lafriks lafriks added the type/enhancement An improvement of existing functionality label Feb 15, 2019
@GiteaBot GiteaBot 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 Feb 15, 2019
Replaced all API method 404s with above method
modules/context/api.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot 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 Feb 15, 2019
@jolheiser
Copy link
Member Author

For the record, I had planned on fixing both things in the original issue, but perhaps this should be a PR on its own just for API 404s. 😄

@techknowlogick techknowlogick added this to the 1.9.0 milestone Feb 19, 2019
@techknowlogick
Copy link
Member

This PR is marked as WIP, is it still WIP?

@jolheiser
Copy link
Member Author

I guess it depends on whether we want the other sub-issue in the original issue fixed in this PR or a separate one. If not, this is complete for API 404s.

@jolheiser jolheiser changed the title WIP: Updates to 404 responses Updates to API 404 responses Feb 21, 2019
@jolheiser
Copy link
Member Author

No comment on the original issue, so I will count this PR as just fixes to API 404s.

@techknowlogick techknowlogick merged commit cac9e6e into go-gitea:master Mar 19, 2019
@jolheiser jolheiser deleted the 6052_better_404 branch March 19, 2019 02:43
@lunny lunny mentioned this pull request Jun 14, 2019
2 tasks
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 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. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants