fiddler 接口调试

本文介绍如何配置HTTP POST请求并正确传递参数至后台的方法。包括设置User-Agent、Host、Content-Length等头部信息,构造请求体携带JSON或表单格式的数据,以及后台如何解码获取这些参数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.parsed   下面的文本框填入下面配置信息,否则参数无法传入到程序后台

User-Agent: Fiddler
Host: localhost:9999
Content-Length: 467
Content-Type: application/x-www-form-urlencoded

或者

User-Agent: Fiddler
Host: hainaopenapitest.sparta.html5.qq.com
Content-Length: 87
Content-Type: application/json

 

 

2.填写请求路径  ,方式选POST,

http://localhost:9999/wsn//tencent/getQRCode.do    

3.request body  下面文本框填写请求参数

data={"community_id":"129","user_id":"157","time_start":"2016-08-17 09:00:00","time_expired":"2016-08-17 18:00:00","user_type":0,
                "use_times":0,"spare_1":"","spare_2":"","spare_3":"","buildings":[{"building_id":"157","building_spare_1":"","building_spare_2":"",
                    "building_spare_3":""},{"building_id":"205","building_spare_1":"","building_spare_2":"","building_spare_3":""}]}&partner_id=1603&key=ohQk0moiQTbgq5Ag
                &sign=E1CC5CEAE99E0C34EC4A4BA7AB689BB8}

 

4.海纳请求案例

请求地址:http://localhost:9999/wsn//tencent/getHNQRCode.do

User-Agent: Fiddler
Host: localhost:9999
Content-Length: 1405
Content-Type: application/x-www-form-urlencoded

 

request body

{"request_id":"hainatest_00001","community_id":307,"time_start":"2017-12-14 15:36:00","time_expired":"2017-12-15 16:00:00","user_type":1,"use_times":0,"open_type":0,"address":[{"layer":1,"id":18581,"name":"二期","parent_id":0,"full_id":"-18581-","full_name":"二期","address":[{"layer":2,"id":18509,"name":"8栋","parent_id":18581,"full_id":"-18581-18509-","full_name":"二期/8栋","address":[{"layer":3,"id":41959,"name":"B单元","parent_id":18509,"full_id":"-18581-18509-41959-","full_name":"二期/8栋/B单元","address":[{"layer":4,"id":45,"name":"808室","parent_id":41959,"full_id":"-18581-18509-41959-45-","full_name":"二期/8栋/B单元/808室","address":[]}]}]}]}],{"request_id":"hainatest_00001","community_id":307,"time_start":"2017-12-14 15:36:00","time_expired":"2017-12-15 16:00:00","user_type":1,"use_times":0,"open_type":0,"address":[{"layer":1,"id":18581,"name":"二期","parent_id":0,"full_id":"-18581-","full_name":"二期","address":[{"layer":2,"id":18509,"name":"8栋","parent_id":18581,"full_id":"-18581-18509-","full_name":"二期/8栋","address":[{"layer":3,"id":41959,"name":"B单元","parent_id":18509,"full_id":"-18581-18509-41959-","full_name":"二期/8栋/B单元","address":[{"layer":4,"id":45,"name":"808室","parent_id":41959,"full_id":"-18581-18509-41959-45-","full_name":"二期/8栋/B单元/808室","address":[]}]}]}]}]},"sign":"928C782B0989F603B160111AD1B4668D"}

 

3.后台servlet 获取请求参数

String data =   URLDecoder.decode(request.getParameter("data"), "utf-8");

转载于:https://my.oschina.net/111222233/blog/1581143

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值