Class: BasicServlet

Inherits:
WEBrick::HTTPServlet::AbstractServlet
  • Object
show all
Defined in:
lib/hanoi/webrick.rb

Direct Known Subclasses

DownServlet, InspectionServlet, SlowServlet

Instance Method Summary collapse

Instance Method Details

#do_GET(req, res) ⇒ Object

Raises:

  • (WEBrick::HTTPStatus::OK)


49
50
51
52
53
54
55
56
57
58
59
# File 'lib/hanoi/webrick.rb', line 49

def do_GET(req, res)
  prevent_caching(res)
  res['Content-Type'] = "text/plain"
  
  req.query.each do |k, v|
    res[k] = v unless k == 'responseBody'
  end
  res.body = req.query["responseBody"]
  
  raise WEBrick::HTTPStatus::OK
end

#do_POST(req, res) ⇒ Object



61
62
63
# File 'lib/hanoi/webrick.rb', line 61

def do_POST(req, res)
  do_GET(req, res)
end