We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// CopyBody returns the raw request body data as bytes. func (input *BeegoInput) CopyBody(MaxMemory int64) []byte { if input.Context.Request.Body == nil { return []byte{} } safe := &io.LimitedReader{R: input.Context.Request.Body, N: MaxMemory} requestbody, _ := ioutil.ReadAll(safe) input.Context.Request.Body.Close() bf := bytes.NewBuffer(requestbody) input.Context.Request.Body = ioutil.NopCloser(bf) input.RequestBody = requestbody return requestbody }
Beego set request body to ioutil.NopCloser(bf).
ioutil.NopCloser(bf)
func parsePostForm(r *Request) (vs url.Values, err error) { ... case ct == "application/x-www-form-urlencoded": var reader io.Reader = r.Body maxFormSize := int64(1<<63 - 1) if _, ok := r.Body.(*maxBytesReader); !ok { maxFormSize = int64(10 << 20) // 10 MB is a lot of text. reader = io.LimitReader(r.Body, maxFormSize+1) } b, e := ioutil.ReadAll(reader) if e != nil { if err == nil { err = e } break } ... }
But for big form, go http library need the request body to be *maxBytesReader
*maxBytesReader
// CopyBody returns the raw request body data as bytes. func (input *BeegoInput) CopyBody(MaxMemory int64) []byte { if input.Context.Request.Body == nil { return []byte{} } safe := &io.LimitedReader{R: input.Context.Request.Body, N: MaxMemory} requestbody, _ := ioutil.ReadAll(safe) input.Context.Request.Body.Close() bf := bytes.NewBuffer(requestbody) input.Context.Request.Body = http.MaxBytesReader(input.Context.ResponseWriter, ioutil.NopCloser(bf), MaxMemory) input.RequestBody = requestbody return requestbody }
The text was updated successfully, but these errors were encountered:
Thanks
Sorry, something went wrong.
7ec819d
No branches or pull requests
Beego set request body to
ioutil.NopCloser(bf)
.But for big form, go http library need the request body to be
*maxBytesReader
The text was updated successfully, but these errors were encountered: