17 lines
524 B
Go
17 lines
524 B
Go
package httpadapter
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
const maxAssessmentSignalBodyBytes int64 = 32 << 10
|
|
|
|
// limitAssessmentSignalBody is called only after the generated router has
|
|
// matched the signal operation. It leaves decoding and authentication order
|
|
// to the generated server while bounding both fixed-length and chunked bodies.
|
|
func limitAssessmentSignalBody(w http.ResponseWriter, request *http.Request) {
|
|
if request.Body != nil {
|
|
request.Body = http.MaxBytesReader(w, request.Body, maxAssessmentSignalBodyBytes)
|
|
}
|
|
}
|