add hub function

This commit is contained in:
cos
2026-04-30 11:44:54 +02:00
parent 909d222a89
commit 0afed9a326
10 changed files with 203 additions and 128 deletions
+4 -4
View File
@@ -8,16 +8,16 @@ import (
"go-socket/packages/config"
)
type requestType uint8
type bodyLimit uint8
const (
normal requestType = iota
normal bodyLimit = iota
file
avatar
profileBg
)
func validCheckWithResponseOnFail(response *http.ResponseWriter, request *http.Request, pt requestType) bool {
func validCheckWithResponseOnFail(response http.ResponseWriter, request *http.Request, pt bodyLimit) bool {
var maxSize int64
switch pt {
case file:
@@ -32,7 +32,7 @@ func validCheckWithResponseOnFail(response *http.ResponseWriter, request *http.R
if request.ContentLength > maxSize {
io.Copy(io.Discard, request.Body)
http.Error(*response, "Request too large", http.StatusRequestEntityTooLarge)
http.Error(response, "Request too large", http.StatusRequestEntityTooLarge)
return false
}