【Postman登錄權限】http的請求添加cookie,使用interceptor攔截瀏覽器發送的請求

要使用postman測試開發的接口時,遇到了登錄權限的問題,本項目的權限是根據cookie中的某個值來作的判斷,那麼就須要在發送post請求的時候附帶cookie內容

發送的http請求時,附帶 cookie參數

  • 經過在chrome中查看線上的接口調用信息,發現登錄權限是經過cookie中的session來肯定的,這樣就須要把這條cookie在postman中設置出來,才能在postman中測試post請求。
  1. 點擊按鈕,彈出cookie設置的窗口
  2. 輸入domin的名稱
  3. 保存domin
  4. 添加具體的cookie參數,每一條都要在這裏添加一下
  5. 前面的cookie的name,後面的是value
  6. 保存該domin下的這一條cookie

圖片描述

經過interceptor攔截請求

  • 攔截器的好處是,不須要手動填寫全部參數,而是直接截取到某個http請求的左右參數設置
  1. 點擊該按鈕,彈出攔截器相關設置窗口
  2. 點擊 interceptor 按鈕
  3. 點擊 ON 打開攔截器,此時右側的應該出現 CONNECTED 的綠色小點,若是是 UNCONNECTED 的灰色小點,能夠參考文檔
  4. 設置在哪裏保存攔截的請求
  5. 對攔截的請求作篩選

添加攔截器

常見問題

攔截器是 UNCONNECTED 的灰色小點
  • 官方提到了這樣的解決方案

官方提到了這樣的解決方案chrome

  • 核心內容是:瀏覽器

    • The cookies and domains will be populated automatically. Can you confirm the following:cookie

      1. Chrome is open, and has the Interceptor extension installed (v0.2.26)
        谷歌瀏覽器是打開狀態,且已經安裝Interceptor擴展
        圖片描述
      2. You’ve completed the installation steps for the bridge
        已經完成安裝 bridge
        圖片描述
      3. The Interceptor Status isn’t updating to ‘Interceptor Connected’ even after restarting Chrome
        重啓谷歌瀏覽器後,Interceptor應用,處於 鏈接中 的狀態
        圖片描述
    • Interceptor 是一個用於攔截chorme瀏覽器的http請求的攔截器,能夠把相關請求發送給postman軟件。
    • Interceptor Bridge 是用來創建瀏覽器和postman軟件之間信息鏈接通道的一個小應用,須要手動安裝。
  • 根據該方案,就能夠使得 UNCONNECTED 的灰色小點變成 CONNECTED 的綠色小點
相關文章
相關標籤/搜索