FakeWebHTTP 请求调试

联合创作 · 2023-10-01 22:50

FakeWeb是一个采用Ruby开发的辅助性的用来伪造Web请求的工具,使用它不需要修改代码或编写相应代码。

使用示例:

  FakeWeb.register_uri(:get, "http://example.com/test1", :string => "Hello World!")

  Net::HTTP.get(URI.parse("http://example.com/test1"))
  => "Hello World!"

  Net::HTTP.get(URI.parse("http://example.com/test2"))
  => FakeWeb is bypassed and the response from a real request is returned
浏览 4
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报