continue minIo, rename convertion methods and http methods

This commit is contained in:
2026-04-14 22:04:12 +02:00
parent 60a02b73c0
commit 53c2f71d5d
7 changed files with 76 additions and 36 deletions
+6 -2
View File
@@ -2,15 +2,19 @@ package http
import (
"net/http"
"go-socket/packages/globals"
)
func postValidCheckWithResponseOnFail(response *http.ResponseWriter, request *http.Request) bool {
func postValidCheckWithResponseOnFail(response *http.ResponseWriter, request *http.Request, withFile bool) bool {
if request.Method != http.MethodPost {
http.Error(*response, "POST only", http.StatusMethodNotAllowed)
return false
}
if request.ContentLength > 8192 {
if withFile && request.ContentLength > int64(globals.MaxPostWithFileBytes) ||
!withFile && request.ContentLength > int64(globals.MaxPostBytes) {
http.Error(*response, "Request too large", http.StatusRequestEntityTooLarge)
return false
}
return true