spec/net_http_server_spec.lua
author Jonas Schäfer <jonas@wielicki.name>
Mon, 03 Oct 2022 12:55:11 +0200
changeset 12743 0dc80024fdd2
parent 8690 ee01578c67cb
permissions -rw-r--r--
Backed out changeset 1bc2220cd6ec The use of the error helpers creates an `<error/>` child element containing the error condition. This is however not allowed as per XEP-0198, which specifies that the error condition is to be a direct child of the `<failed/>` stream management element. This has triggered a fun reconnect loop in aioxmpp where it was reported by a user [1]. [1]: https://github.com/horazont/aioxmpp/issues/382

describe("net.http.server", function ()
	package.loaded["net.server"] = {}
	local server = require "net.http.server";
	describe("events", function ()
		it("should work with util.helpers", function ()
			-- See #1044
			server.add_handler("GET host/foo/*", function () end, 0);
			server.add_handler("GET host/foo/bar", function () end, 0);
			local helpers = require "util.helpers";
			assert.is.string(helpers.show_events(server._events));
		end);
	end);
end);