From 432b9a4451997742df50d3db33285f2dd5ea0bef Mon Sep 17 00:00:00 2001 From: Gusted Date: Thu, 7 Dec 2023 23:17:14 +0100 Subject: [PATCH] [GITEA] Make HTTPS schema default for Swagger - Switch the supported schemas for the Swagger API around, such that https is the first one listed. This ensures that when the Swagger API is used it will default to the https schema, which is likely the schema you want to use in the majority of the cases. - Resolves #1895 BREAKING CHANGE NOTICE: If you are using the Swagger API JSON directly to communicate with the Forgejo API, the library you are using may be using the first schema defined in the JSON file (e.g. https://code.forgejo.org/swagger.v1.json) to construct the request url, this used to be `http` but has now changed to `https`. This can cause failures if you want to send the swagger request over `http` (and there is no HTTPS redirection configured). (cherry picked from commit 81e5f438868192e9cca46824ceb3db787bdd8629) (cherry picked from commit d847469ea278e77ed4fd6147dd54025ce222ebc9) (cherry picked from commit 96e75e1d5ca97cd4c668fc60d444dc91c98e83a6) (cherry picked from commit 65baa6426109403f0b8a779b061f7733d8034ba7) (cherry picked from commit cd3e0a74e6a7bb90da6f069b7fea0796d5f3d775) (cherry picked from commit a3127e90b21660d1d7efb6dd536f5fb5619d3307) (cherry picked from commit 2b22272dc588ee6c2c4081b087f5b87b82ac52c8) (cherry picked from commit 7363790592b10c4fc52266fd0c33ed79454cd276) --- routers/api/v1/api.go | 2 +- templates/swagger/v1_json.tmpl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index e244a0e4f9..e718924a81 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -6,7 +6,7 @@ // // This documentation describes the Gitea API. // -// Schemes: http, https +// Schemes: https, http // BasePath: /api/v1 // Version: {{AppVer | JSEscape | Safe}} // License: MIT http://opensource.org/licenses/MIT diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 10202d26dd..52dface646 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -8,8 +8,8 @@ "text/html" ], "schemes": [ - "http", - "https" + "https", + "http" ], "swagger": "2.0", "info": {