1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 03:23:49 +08:00

fix: form parse.

Fixes: #960
This commit is contained in:
wdvxdr 2021-07-15 10:13:24 +08:00
parent 54cef1fd37
commit 426aa5718f
No known key found for this signature in database
GPG Key ID: 55FF1414A69CEBA6

View File

@ -85,6 +85,11 @@ func (s *httpServer) ServeHTTP(writer http.ResponseWriter, request *http.Request
ctx.json = gjson.Parse(utils.B2S(body))
}
if strings.Contains(contentType, "application/x-www-form-urlencoded") {
err := request.ParseForm()
if err != nil {
log.Warnf("已拒绝客户端 %v 的请求: %v", request.RemoteAddr, err)
writer.WriteHeader(http.StatusBadRequest)
}
ctx.postForm = request.PostForm
}
fallthrough