diff --git a/test/support/servlets/redirector_307.rb b/test/support/servlets/redirector_307.rb new file mode 100644 index 00000000..dce6be6a --- /dev/null +++ b/test/support/servlets/redirector_307.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require_relative "test" + +class Redirector307Server < TestServer + class RedirectPostApp < WEBrick::HTTPServlet::AbstractServlet + def do_POST(_req, res) # rubocop:disable Naming/MethodName + res.set_redirect(WEBrick::HTTPStatus::TemporaryRedirect, "/") + end + end + + class PostApp < WEBrick::HTTPServlet::AbstractServlet + def do_POST(_req, res) # rubocop:disable Naming/MethodName + res.body = "ok" + end + end + + def initialize(options = {}) + super + mount("/", PostApp) + mount("/307", RedirectPostApp) + end +end