最近研究fiddler菜单无意中发现,居然可以导出会话并生成curl脚本,curl脚本可以在Linux下执行,对远程定位接口问题很有帮助。
在fiddler界面,依次点击edit–export sessions–selected sessions,选择curl即可,
导出的内容如下,
curl -k -i –raw -o 0.dat -X POST -d "username=123456&password=123456&oauth_token=bbffb757381df45f118a2c286ac01abb31a01fa16acd6f3df6b640a373aa5db03acce5cfb5443ad9a516c1b8e3ab8c49&denyCallbackURL=http%%3A%%2F%%2Fwww.yy.com%%2Flogin%%2FudbCallback%%3Fcancel%%3D1&UIStyle=xelogin&appid=5719&mxc=&vk=&isRemMe=0&mmc=&vv=" "https://lgn.yy.com/lgn/oauth/x2/s/login_asyn.do" -H "Host: lgn.yy.com" -H "Connection: keep-alive" -H "Accept: */*" -H "Origin: https://lgn.yy.com" -H "X-Requested-With: XMLHttpRequest" -H "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "Referer: https://lgn.yy.com/lgn/oauth/authorize.do?oauth_token=bbffb757381df45f118a2c286ac01abb31a01fa16acd6f3df6b640a373aa5db03acce5cfb5443ad9a516c1b8e3ab8c49&denyCallbackURL=http://www.yy.com/login/udbCallback?cancel=1&cssid=5719®CallbackURL=/login/udbCallback&UIStyle=xelogin&rdm=0.5864189190174589" -H "Accept-Encoding: gzip, deflate, br" -H "Accept-Language: zh-CN,zh;q=0.8" -H "Cookie: hiido_ui=0.04192364679703209; hd_newui=0.7087754036085749; Hm_lvt_c493393610cdccbddc1f124d567e36ab=1479402956; Hm_lpvt_c493393610cdccbddc1f124d567e36ab=1479402964; LGNJSESSIONID=f9959b2f0a340c129ced386b9d7c778afeccd997; token=avg9_wv7txh7:7u89z9u5y9xvx2wu909z73:4104x7192490x2y9w83184693"
在Linux命令行下执行上述curl,结果如下图,
也就是说,接口的请求可以在Linux下面直接运行了,跑开了GUI界面的繁琐,特别是在排查服务器接口故障的时候很有用。