Skip to content

Commit

Permalink
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spec/std/http/chunked_content_spec.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require "spec"
require "http/content"

describe HTTP::ChunkedContent do
it "delays reading the next chunk as soon as one is consumed (#3270)" do
mem = MemoryIO.new("4\r\n123\n\r\n0\r\n\r\n")
content = HTTP::ChunkedContent.new(mem)
bytes = uninitialized UInt8[4]
bytes_read = content.read(bytes.to_slice)
bytes_read.should eq(4)
String.new(bytes.to_slice).should eq("123\n")
mem.pos.should eq(7) # only this chunk was read
end
end

0 comments on commit fbb5b16

Please sign in to comment.