Sha256: 5934103b2b38439c1f68825707a9b760a49eaff0149a03cd4f219823c77a7234

Contents?: true

Size: 971 Bytes

Versions: 17

Compression:

Stored size: 971 Bytes

Contents

# frozen_string_literal: true
require 'webrick'
require 'mechanize/test_case/servlets'

server = WEBrick::HTTPServer.new :Port => 8000
server.mount_proc '/' do |req, res|
  res.content_type = 'text/html'

  servlets = MECHANIZE_TEST_CASE_SERVLETS.map do |path, servlet|
    "<dt>#{servlet}<dd><a href=\"#{path}\">#{path}</a>"
  end.join "\n"

  res.body = <<-BODY
<!DOCTYPE html>
<title>Mechanize Test Case Servlets</title>
<p>This server allows you to test various mechanize behavior against other
HTTP clients.  Some endpoints may require headers be set to have a reasonable
function, or may respond diffently to POST vs GET requests.  Please see the
servlet implementation and mechanize tests for further details.

<p>Here are the servlet endpoints available:

<dl>
#{servlets}
</dl>
  BODY
end

MECHANIZE_TEST_CASE_SERVLETS.each do |path, servlet|
  server.mount path, servlet
end

trap 'INT'  do server.shutdown end
trap 'TERM' do server.shutdown end

server.start

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mechanize-2.14.0 lib/mechanize/test_case/server.rb
mechanize-2.13.0 lib/mechanize/test_case/server.rb
mechanize-2.12.2 lib/mechanize/test_case/server.rb
mechanize-2.12.1 lib/mechanize/test_case/server.rb
mechanize-2.12.0 lib/mechanize/test_case/server.rb
mechanize-2.11.0 lib/mechanize/test_case/server.rb
mechanize-2.10.1 lib/mechanize/test_case/server.rb
mechanize-2.10.0 lib/mechanize/test_case/server.rb
mechanize-2.9.2 lib/mechanize/test_case/server.rb
mechanize-2.9.1 lib/mechanize/test_case/server.rb
mechanize-2.9.0 lib/mechanize/test_case/server.rb
mechanize-2.8.5 lib/mechanize/test_case/server.rb
mechanize-2.8.4 lib/mechanize/test_case/server.rb
mechanize-2.8.3 lib/mechanize/test_case/server.rb
mechanize-2.8.2 lib/mechanize/test_case/server.rb
mechanize-2.8.1 lib/mechanize/test_case/server.rb
mechanize-2.8.0 lib/mechanize/test_case/server.rb