Diff

spec/net_http_parser_spec.lua @ 11021:9673c95895fb

net.http.parser: Allow specifying sink for large request bodies This enables uses such as saving uploaded files directly to a file on disk or streaming parsing of payloads. See #726
author Kim Alvefur <zash@zash.se>
date Sat, 01 Aug 2020 18:41:23 +0200
parent 10497:a9fb553b6dbb
child 11030:388f599f66d1
line wrap: on
line diff
--- a/spec/net_http_parser_spec.lua	Sat Aug 01 18:14:09 2020 +0200
+++ b/spec/net_http_parser_spec.lua	Sat Aug 01 18:41:23 2020 +0200
@@ -3,7 +3,9 @@
 local function test_stream(stream, expect)
 	local success_cb = spy.new(function (packet)
 		assert.is_table(packet);
-		assert.is_equal(expect.body, packet.body);
+		if packet.body ~= false then
+			assert.is_equal(expect.body, packet.body);
+		end
 	end);
 
 	stream = stream:gsub("\n", "\r\n");
@@ -79,7 +81,7 @@
 
 ]],
 				{
-					body = "Hello", count = 1;
+					body = "Hello", count = 2;
 				}
 			);
 		end);
@@ -108,7 +110,7 @@
 
 ]],
 				{
-					body = "Hello", count = 2;
+					body = "Hello", count = 3;
 				}
 			);
 		end);