在Linux系統下使用Postman設置請求頭,可以按照以下步驟操作:
打開Postman:
postman 并回車,啟動Postman應用程序。創建或選擇一個請求:
進入請求頭部分:
添加請求頭:
Content-Type。application/json。使用預請求腳本設置環境變量(可選):
const customHeader = 'your_custom_value';
pm.environment.set('X-Custom-Header', customHeader);
your_custom_value 替換為你的自定義頭部值。const response = pm.sendRequest({
method: 'GET',
url: pm.environment.get('X-Custom-Header') + 'your_api_endpoint'
});
將 your_api_endpoint 替換為你的API端點。發送請求:
通過以上步驟,你可以在Linux系統下使用Postman發送各種HTTP請求,并設置自定義請求頭。