1.http服务脚本.md

模拟http打印response

  • print_http_body.rb
require 'webrick'

server = WEBrick::HTTPServer.new(:Port => ARGV.first)
server.mount_proc '/' do |req, res|
  puts req.body
end

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

启动:ruby print_http_body.rb 8000


Copyright © 2018 INSTALL.REN