Apply MAX_MESSAGE_SIZE to the whole request body (closes #250)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
Creating a session, logging in and posting a message stopped reading after the first JSON value, so the limit never saw the rest of the body and trailing bytes were ignored. All three now read the whole limited body and decode it with json.Unmarshal. A body over the limit, or anything but whitespace after the value, gets 400 invalid request body. Model: opus-5-5
This commit is contained in:
@@ -188,7 +188,7 @@ func (hdlr *Handlers) handleCreateSession(
|
||||
|
||||
var payload createRequest
|
||||
|
||||
err := json.NewDecoder(request.Body).Decode(&payload)
|
||||
err := decodeJSON(request, &payload)
|
||||
if err != nil {
|
||||
hdlr.respondError(
|
||||
writer, request,
|
||||
@@ -925,7 +925,7 @@ func (hdlr *Handlers) HandleSendCommand() http.HandlerFunc {
|
||||
|
||||
var payload commandRequest
|
||||
|
||||
err := json.NewDecoder(request.Body).Decode(&payload)
|
||||
err := decodeJSON(request, &payload)
|
||||
if err != nil {
|
||||
hdlr.respondError(
|
||||
writer, request,
|
||||
|
||||
Reference in New Issue
Block a user