mirror of
https://github.com/versia-pub/versia-go.git
synced 2025-12-06 14:28:20 +01:00
24 lines
590 B
Go
24 lines
590 B
Go
package meta_handler
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
func (i *Handler) GetHostMeta(c *fiber.Ctx) error {
|
|
if c.Accepts(fiber.MIMEApplicationJSON) != "" {
|
|
return i.GetHostMetaJSON(c)
|
|
}
|
|
|
|
if c.Accepts(fiber.MIMEApplicationXML) != "" {
|
|
c.Set(fiber.HeaderContentType, fiber.MIMEApplicationXMLCharsetUTF8)
|
|
return c.Send(i.hostMeta.XML)
|
|
}
|
|
|
|
return c.Status(fiber.StatusNotAcceptable).SendString("Not Acceptable")
|
|
}
|
|
|
|
func (i *Handler) GetHostMetaJSON(c *fiber.Ctx) error {
|
|
c.Set(fiber.HeaderContentType, fiber.MIMEApplicationJSONCharsetUTF8)
|
|
return c.Send(i.hostMeta.JSON)
|
|
}
|