File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
1919### Changed
2020
21+ - Improved error message when request body size cannot be determined to suggest
22+ setting ` Content-Length ` explicitly or using chunked ` Transfer-Encoding ` (#560 )
2123- ** BREAKING** ` Connection#readpartial ` now raises ` EOFError ` instead of
2224 returning ` nil ` at end-of-stream, and supports an ` outbuf ` parameter,
2325 conforming to the ` IO#readpartial ` API. ` Body#readpartial ` and
Original file line number Diff line number Diff line change @@ -54,7 +54,9 @@ def size
5454 elsif @source . nil?
5555 0
5656 else
57- raise RequestError , "cannot determine size of body: #{ @source } "
57+ raise RequestError ,
58+ "cannot determine size of body: #{ @source . inspect } ; " \
59+ "set the Content-Length header explicitly or use chunked Transfer-Encoding"
5860 end
5961 end
6062
Original file line number Diff line number Diff line change 291291 err = assert_raises ( HTTP ::RequestError ) { subject_under_test . size }
292292 assert_match ( /cannot determine size of body/ , err . message )
293293 assert_includes err . message , body . inspect
294+ assert_match ( /Content-Length/ , err . message )
295+ assert_match ( /chunked Transfer-Encoding/ , err . message )
294296 end
295297 end
296298 end
You can’t perform that action at this time.
0 commit comments