-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
API error cleanup #7186
API error cleanup #7186
Conversation
Replaced DocURL with SwaggerURL Added error for fork already existing Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Signed-off-by: jolheiser <john.olheiser@gmail.com>
@@ -580,17 +582,17 @@ func NewContext() { | |||
AppURL = strings.TrimRight(AppURL, "/") + "/" | |||
|
|||
// Check if has app suburl. | |||
url, err := url.Parse(AppURL) | |||
appURL, err := url.Parse(AppURL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed url
to appURL
because url
collides with the Go url
package, and also to clarify the variable for use down below
@@ -899,6 +901,10 @@ func NewContext() { | |||
log.Fatal("Failed to map Metrics settings: %v", err) | |||
} | |||
|
|||
u := *appURL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
De-referenced the pointer in case anyone uses appURL
in a later change, since right below this I fudge the u.Path
manually.
Signed-off-by: jolheiser <john.olheiser@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #7186 +/- ##
==========================================
+ Coverage 41.72% 41.73% +<.01%
==========================================
Files 449 449
Lines 61129 61127 -2
==========================================
+ Hits 25506 25511 +5
+ Misses 32310 32302 -8
- Partials 3313 3314 +1
Continue to review full report at Codecov.
|
I removed
base.DocURL
completely because it shows up in Swagger errors and doesn't necessarily help with said errors.It is a valuable link for users who create clients to interact with the Gitea API, however in the context of Swagger it's not entirely helpful in my opinion.
This PR adds
settings.API.SwaggerURL
which is simply the path to a given instance's base Swagger page and is used in any API error.