You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently ran into an issue where my program was printing "http: request body too
large". I found where that error is created in the package source
(http://golang.org/src/pkg/net/http/request.go#L656), but it seems that the error isn't
exported out of the package, so my application can't properly detect this specific error.
The text was updated successfully, but these errors were encountered:
These need to be evaluated on a case-bv-case basis, so changing the subject.
At least in this case if you really care about the difference between too large and
other errors, you can simply count the incoming bytes yourself.
The real magic of MaxBytesReader is that it lets you not only stop reading (like an
io.LimitReader), but also marks the underlying http connection as dead, so it's not
reused in the next request. This mattered in more before Go 1.2 when it would always try
to advance to the next request if your handler didn't reach EOF on its own. Nowadays
MaxBytesReader is convenient but not really required for anything. I don't think it's
worth exporting more things in net/http or expanding any documentation for this case.
Nothing in the current code precludes people with special needs from doing what they
need.
If there are other unexported errors, please file separate bugs for them.
by staley.dylan:
The text was updated successfully, but these errors were encountered: