spec/net_http_parser_spec.lua
changeset 11034 388f599f66d1
parent 11025 9673c95895fb
child 11035 57739c591a8c
--- a/spec/net_http_parser_spec.lua	Thu Aug 20 16:43:27 2020 +0200
+++ b/spec/net_http_parser_spec.lua	Fri Aug 21 13:41:51 2020 +0100
@@ -1,4 +1,5 @@
 local http_parser = require "net.http.parser";
+local sha1 = require "util.hashes".sha1;
 
 local function test_stream(stream, expect)
 	local success_cb = spy.new(function (packet)
@@ -115,4 +116,15 @@
 			);
 		end);
 	end);
+
+	pending("should handle large chunked responses", function ()
+		local data = io.open("spec/inputs/httpstream-chunked-test.txt", "rb"):read("*a");
+
+		-- Just a sanity check... text editors and things may mess with line endings, etc.
+		assert.equal("25930f021785ae14053a322c2dbc1897c3769720", sha1(data, true), "test data malformed");
+
+		test_stream(data, {
+			body = string.rep("~", 11085), count = 2;
+		});
+	end);
 end);