continue minIo, rename convertion methods and http methods
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user