我们写好一个Web接口以后,需要进行相关测试,有时可以在HTML中写表单来测试,有时也可以通过代码中HttpClient来写代码来请求,但是这两种方法使用起来并不是特别方便,另外当参数比较多的时候,或者传递XML或者JSON时,有些不太方便。
我们可以使用基于火狐浏览器Mozilla Firefox的RESTClient和HttpRequester插件来做这件事。
Firefox安装附加组件,你可以在浏览器地址栏直接输入about:addons或者通过菜单打开。
RESTClient
a debugger for RESTful web services.RESTClient是一款用于测试各种Web服务的插件,它可以向服务器发送各种HTTP请求(用户也可以自定义请求方式),并显示服务器响应。
使用RESTClient您可以方便的测试各种Web服务,为您的Web开发提供帮助。
![Web测试调试插件RESTClient和HttpRequester Web测试调试插件RESTClient和HttpRequester](http://www.javacui.com/ueditor/php/upload/image/20150716/1437034787879559.jpg)
这里用GET请求连接我的博客,没有写参数,最下面的四个选项卡分别显示请求回来的信息。
HttpRequester
A tool for easily making HTTP requests (GET/PUT/POST/DELETE), and keeping a history of transactions.This tool is useful when doing web or REST development, or when you need to make HTTP requests that are not easily done via the browser (PUT/POST/DELETE).
This is based off of the Poster addon, with a focus on preserving the history of transactions, allowing you to go back and review, re-execute, and save/load HTTP requests.
HttpRequester can be opened via the Toolbar button (dual-arrow icon).
Note that the Browser response view works well in conjunction with other response display addons like 'XML Pretty Viewer' and 'JSONView'. The HttpRequester browser will utilize the nicely-formatted displays that those addons provide.
See Developer's Comments section below for full usage details。
![Web测试调试插件RESTClient和HttpRequester Web测试调试插件RESTClient和HttpRequester](http://www.javacui.com/ueditor/php/upload/image/20150716/1437034796443560.jpg)
这里用GET请求连接我的博客,没有选择参数类型,也没有写参数,右边显示了返回的请求信息。