tests: add proxy controller tests

This commit is contained in:
Stavros
2025-09-03 15:30:24 +03:00
parent bb0373758a
commit ba46493a7b
2 changed files with 173 additions and 0 deletions

View File

@@ -55,6 +55,15 @@ func (controller *ProxyController) proxyHandler(c *gin.Context) {
return
}
if req.Proxy != "nginx" && req.Proxy != "traefik" && req.Proxy != "caddy" {
log.Warn().Str("proxy", req.Proxy).Msg("Invalid proxy")
c.JSON(400, gin.H{
"status": 400,
"message": "Bad Request",
})
return
}
isBrowser := strings.Contains(c.Request.Header.Get("Accept"), "text/html")
if isBrowser {