![]() Test plan: - Run the following and check that it raises a ResponseTooLarge error. resp = CanvasHttp.get('http://example.com', max_response_length: 1000) - Run the following and make sure no error is raised and resp.body is a String with the full response body: resp = CanvasHttp.get('http://example.com', max_response_length: 2000) - Now let's try to get a file that Net::HTTP splits up into more than one chunk. Add a `puts "CHUNK #{chunk.size}"` into the `response.read_body` block in `read_body_max_length`. - Find a big test file on the interwebs (actually the chunk size seems to be only a couple kb so it doesn't have to be that big), or possibly host one yourself locally with `python -m SimpleHTTPServer 8000` - Make it fail by setting max_response_length to be less a little than the total length. Make sure more than one chunk was fetched. - Make it succeed by setting max_response_length to be a little more than the total length. Make sure more than one chunk was fetched. Make sure the body is intact (e.g. fetch without a max_response_length, then check resp1.body == resp2.body) refs INTEROP-6709 flag=none Change-Id: I0929dfd32a4f4e9bfb6b18c58c5decac265123af Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/263126 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Cody Cutrer <cody@instructure.com> Reviewed-by: Xander Moffatt <xmoffatt@instructure.com> QA-Review: Xander Moffatt <xmoffatt@instructure.com> Product-Review: Evan Battaglia <ebattaglia@instructure.com> |
||
---|---|---|
.. | ||
lib | ||
spec | ||
Gemfile | ||
Rakefile | ||
canvas_http.gemspec | ||
test.sh |