Class: BasicServlet

Inherits:
WEBrick::HTTPServlet::AbstractServlet
  • Object
show all
Defined in:
lib/newjs/jstest.rb

Direct Known Subclasses

DownServlet, InspectionServlet, SlowServlet

Instance Method Summary collapse

Instance Method Details

#do_GET(req, res) ⇒ Object

Raises:

  • (WEBrick::HTTPStatus::OK)


213
214
215
216
217
218
219
220
221
222
223
# File 'lib/newjs/jstest.rb', line 213

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



225
226
227
# File 'lib/newjs/jstest.rb', line 225

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