后來經過仔細對比研究發現,postman有一個chrome插件 Postman Interceptor,可以讓postman中發送請求的時候使用這個網站的瀏覽器cookie。我同事用了這個插件,發送請求的時候帶上了自己的cookie,所以才能訪問。
於是仔細研究了一下這款chrome Postman Intercepto插件。
Postman Interceptor的主要功能
記錄瀏覽器請求並直接導入到Postman
可添加Filter,對瀏覽器中的請求進行過濾
如何安裝Postman Interceptor?
1. 下載Postman Intercepter chrome插件,其格式是一個crx文件。
2. 在谷歌中打開:chrome://extensions/
3. 拖動crx文件到chrome://extensions/頁面。
4. 在“要添加‘Postman interceptor’嗎”對話框上點擊“添加擴展程序”。
5. 然后就可以看到瀏覽器右上角的postman interceptor 工具圖標
Postman Intercepter使用方法
1.在Postman工具中打開postman Intercepter功能
2. 如果只需要測試特定網站,可以在 postman interceptor插件中設置 Filter requests。
Filter requests默認是“.*”,表示捕獲所有的網站。如果只想要捕獲百度,可以在Filter requests里輸入“baidu”。
3. 在chrome中進行操作,比如打開百度,然后搜索關鍵字“hello”,然后點擊“百度一下”。
4. 打開 postman interceptor。可以看到 “last 10 requests“。
5. 打開Postman,可以看到“History”顯示chrome中進行的操作。
6. 然后就可以在Postman對 request進行修改,過濾,以及編寫測試。
Postman Interceptor,可以讓postman中發送請求的時候使用這個網站的瀏覽器cookie。發送請求的時候帶上了自己的cookie,如果在嘗試獲取數據時不能訪問,可以考慮Postman Interceptor。
這款插件的下載地址:http://www.cnplugins.com/devtool/postman-interceptor/download.html
也發了一個很好的chrome插件網,chrome插件幾乎在這個網站上都能找到。
reflink: