From 07bc14e999d26e2db19384d9c12b01d70bbd67a3 Mon Sep 17 00:00:00 2001 From: zam Date: Tue, 7 May 2024 08:56:48 +0700 Subject: [PATCH] feat(handler): add serve yaml --- swagger.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/swagger.go b/swagger.go index 3b575ce..7a3544f 100644 --- a/swagger.go +++ b/swagger.go @@ -197,12 +197,14 @@ func Handler(configFns ...func(*Config)) http.HandlerFunc { w.Header().Set("Content-Type", "image/png") case ".json": w.Header().Set("Content-Type", "application/json; charset=utf-8") + case ".yaml": + w.Header().Set("Content-Type", "text/plain; charset=utf-8") } switch path { case "index.html": _ = index.Execute(w, config) - case "doc.json": + case "doc.json", "doc.yaml": doc, err := swag.ReadDoc(config.InstanceName) if err != nil { http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)