loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Use correct response code in push mirror creation response in v1_json.tmpl (#25476)

In the process of doing a bit of automation via the API, we've
discovered a _small_ issue in the Swagger definition. We tried to create
a push mirror for a repository, but our generated client raised an
exception due to an unexpected status code.

When looking at this function:

https://github.com/go-gitea/gitea/blob/3c7f5ed7b5bff347198cbb26492e6354ea42733b/routers/api/v1/repo/mirror.go#L236-L240

We see it defines `201 - Created` as response:

https://github.com/go-gitea/gitea/blob/3c7f5ed7b5bff347198cbb26492e6354ea42733b/routers/api/v1/repo/mirror.go#L260-L262

But it actually returns `200 - OK`:

https://github.com/go-gitea/gitea/blob/3c7f5ed7b5bff347198cbb26492e6354ea42733b/routers/api/v1/repo/mirror.go#L373

So I've just updated the Swagger definitions to match the code😀

---------

Co-authored-by: Giteabot <teabot@gitea.io>

authored by

Georg Dangl
Giteabot
and committed by
GitHub
95388423 b4d0036f

+2 -2
+1 -1
routers/api/v1/repo/mirror.go
··· 258 258 // schema: 259 259 // "$ref": "#/definitions/CreatePushMirrorOption" 260 260 // responses: 261 - // "201": 261 + // "200": 262 262 // "$ref": "#/responses/PushMirror" 263 263 // "403": 264 264 // "$ref": "#/responses/forbidden"
+1 -1
templates/swagger/v1_json.tmpl
··· 10729 10729 } 10730 10730 ], 10731 10731 "responses": { 10732 - "201": { 10732 + "200": { 10733 10733 "$ref": "#/responses/PushMirror" 10734 10734 }, 10735 10735 "400": {