Add Version

This commit is contained in:
Gianni Carafa
2023-11-02 22:05:57 +01:00
parent e748cb09a5
commit 7f4d749c55

View File

@@ -1,7 +1,8 @@
package handlers
import (
"io"
_ "embed"
"log"
"net/http"
"net/url"
@@ -9,6 +10,9 @@ import (
"github.com/gofiber/fiber/v2"
)
//go:embed VERSION
var version string
func Api(c *fiber.Ctx) error {
// Get the url from the URL
urlQuery := c.Params("*")
@@ -41,6 +45,7 @@ func Api(c *fiber.Ctx) error {
}
body := rewriteHtml(bodyB, u)
response := Response{
Version: version,
Body: body,
}
response.Request.Headers = make([]interface{}, 0)
@@ -63,6 +68,7 @@ func Api(c *fiber.Ctx) error {
}
type Response struct {
Version string `json:"version"`
Body string `json:"body"`
Request struct {
Headers []interface{} `json:"headers"`