You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

swagger_json.go 704B

123456789101112131415161718192021222324
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package routers
  5. import (
  6. "code.gitea.io/gitea/modules/base"
  7. "code.gitea.io/gitea/modules/context"
  8. "code.gitea.io/gitea/modules/log"
  9. )
  10. // tplSwaggerV1Json swagger v1 json template
  11. const tplSwaggerV1Json base.TplName = "swagger/v1_json"
  12. // SwaggerV1Json render swagger v1 json
  13. func SwaggerV1Json(ctx *context.Context) {
  14. t := ctx.Render.TemplateLookup(string(tplSwaggerV1Json))
  15. ctx.Resp.Header().Set("Content-Type", "application/json")
  16. if err := t.Execute(ctx.Resp, ctx.Data); err != nil {
  17. log.Error("%v", err)
  18. ctx.Error(500)
  19. }
  20. }