Comparison

spec/net_http_parser_spec.lua @ 11030:388f599f66d1

net.http.parser: Add failing test for (large?) chunk-encoded responses
author Matthew Wild <mwild1@gmail.com>
date Fri, 21 Aug 2020 13:41:51 +0100
parent 11021:9673c95895fb
child 11031:57739c591a8c
comparison
equal deleted inserted replaced
11029:5550fc5e83f3 11030:388f599f66d1
1 local http_parser = require "net.http.parser"; 1 local http_parser = require "net.http.parser";
2 local sha1 = require "util.hashes".sha1;
2 3
3 local function test_stream(stream, expect) 4 local function test_stream(stream, expect)
4 local success_cb = spy.new(function (packet) 5 local success_cb = spy.new(function (packet)
5 assert.is_table(packet); 6 assert.is_table(packet);
6 if packet.body ~= false then 7 if packet.body ~= false then
113 body = "Hello", count = 3; 114 body = "Hello", count = 3;
114 } 115 }
115 ); 116 );
116 end); 117 end);
117 end); 118 end);
119
120 pending("should handle large chunked responses", function ()
121 local data = io.open("spec/inputs/httpstream-chunked-test.txt", "rb"):read("*a");
122
123 -- Just a sanity check... text editors and things may mess with line endings, etc.
124 assert.equal("25930f021785ae14053a322c2dbc1897c3769720", sha1(data, true), "test data malformed");
125
126 test_stream(data, {
127 body = string.rep("~", 11085), count = 2;
128 });
129 end);
118 end); 130 end);