Firefox Add-on RESTclient - How to input POST parameters?

I've installed Firefox RESTclient add-on but , I'm having hard time figuring out how to pass POST parameters. Is there a specific format to do this? Or is there any other tool which can be used to debug an REST API on Mac OS X ?

198581 次浏览

You can send the parameters in the URL of the POST request itself.

示例网址:

localhost:8080/abc/getDetails?paramter1=value1&parameter2=value2

Once you copy such type of URL in Firefox REST client make a POST call to the server you want

If you want to submit a POST request

  1. 必须将 Firefox 插件的“ 请求头”部分设置为“ 姓名”= “ Content-Type”和“ 价值”= “ application/x-www-form-urlencoded
  2. 现在,您可以在“ request body”文本区域提交类似“ name=mynamehere&title=TA”的参数

下面是一个逐步指南(我认为这应该是预先加载的附加组件) :

  1. 在 RESTClient-> Header-> Custom Header 的顶部菜单中
  2. 在弹出框中,输入 姓名: Content-Type价值: application/x-www-form-urlencoded
  3. 选中“保存到最喜欢的”框,然后单击“确定”。
    Now you will see a "Headers" section with your newly added data.
  4. 然后在 Body 部分,你可以输入你的数据发布如下:

    username=test&name=Firstname+Lastname
    
  5. Whenever you want to make a post request, from the Headers main menu, select the Content-Type:application/x-www-form-urlencoded item that you added and it should work.

I tried the methods mentioned in some other answers, but they look like workarounds to me. Using Firefox Add-on RESTclient to send HTTP POST requests with parameters is not straightforward in my opinion, at least for the version I'm currently using, 2.0.1.

相反,尝试使用其他免费的开源工具,如 ApacheJMeter。它简单明了(见下面的截图)

enter image description here

需要按照下面的图像设置请求头。add request header

在文本区域中,request body 可以作为 json 字符串传递。 enter image description here