remove forced POST in request
This commit is contained in:
@@ -21,7 +21,7 @@ import (
|
||||
)
|
||||
|
||||
func HandleDm(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ func HandleDm(response http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
|
||||
func HandleUserGetConnectionMessages(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
@@ -158,7 +158,7 @@ func HandleUserGetConnectionMessages(response http.ResponseWriter, request *http
|
||||
}
|
||||
|
||||
func HandleUserNewConnection(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
@@ -217,7 +217,7 @@ func HandleUserNewConnection(response http.ResponseWriter, request *http.Request
|
||||
}
|
||||
|
||||
func HandleUserDeleteConnection(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
@@ -270,7 +270,7 @@ func HandleUserDeleteConnection(response http.ResponseWriter, request *http.Requ
|
||||
}
|
||||
|
||||
func HandleUserElevateConnection(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
@@ -330,7 +330,7 @@ func HandleUserElevateConnection(response http.ResponseWriter, request *http.Req
|
||||
}
|
||||
|
||||
func HandleUserDeElevateConnection(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ func HandleUserDeElevateConnection(response http.ResponseWriter, request *http.R
|
||||
}
|
||||
|
||||
func HandleUserGetConnections(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func HandleAttachmentFileUpload(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postFile) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postFile) {
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
@@ -61,7 +61,7 @@ func HandleAttachmentFileUpload(response http.ResponseWriter, request *http.Requ
|
||||
}
|
||||
|
||||
func HandleGetUserAvatar(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
@@ -100,7 +100,7 @@ func HandleGetUserAvatar(response http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
|
||||
func HandleGetUserProfileBg(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
@@ -138,7 +138,7 @@ func HandleGetUserProfileBg(response http.ResponseWriter, request *http.Request)
|
||||
}
|
||||
|
||||
func HandleAttachmentFileDownload(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
|
||||
@@ -17,12 +17,7 @@ const (
|
||||
postProfileBg
|
||||
)
|
||||
|
||||
func postValidCheckWithResponseOnFail(response *http.ResponseWriter, request *http.Request, pt postType) bool {
|
||||
if request.Method != http.MethodPost {
|
||||
http.Error(*response, "POST only", http.StatusMethodNotAllowed)
|
||||
return false
|
||||
}
|
||||
|
||||
func validCheckWithResponseOnFail(response *http.ResponseWriter, request *http.Request, pt postType) bool {
|
||||
var maxSize int64
|
||||
switch pt {
|
||||
case postFile:
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
func HandleUserNewToken(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ func HandleUserNewToken(response http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
|
||||
func HandleUserNew(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ func HandleUserNew(response http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
|
||||
func HandleUserDelete(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
@@ -141,7 +141,7 @@ func HandleUserDelete(response http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
|
||||
func HandleUserModProfile(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ func HandleUserModProfile(response http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
|
||||
func HandleUserModAvatar(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postAvatar) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postAvatar) {
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
@@ -254,7 +254,7 @@ func HandleUserModAvatar(response http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
|
||||
func HandleUserModProfileBg(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postProfileBg) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postProfileBg) {
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
@@ -317,7 +317,7 @@ func HandleUserModProfileBg(response http.ResponseWriter, request *http.Request)
|
||||
}
|
||||
|
||||
func HandleUserGetUser(response http.ResponseWriter, request *http.Request) {
|
||||
if !postValidCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
if !validCheckWithResponseOnFail(&response, request, postNormal) {
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
|
||||
Reference in New Issue
Block a user