从Postman生成的代码中的postman令牌标头属性是什么?
我一直在使用postman来探索REST接口。当使用Postman的代码生成功能时,无论我选择哪种编程语言,Postman都会在标头中添加一个属性。为什么会在那里?postman-token
例如,请参阅 PHP Curl:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(CURLOPT_URL => "https://myURL.com,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"authorization: Basic abcdefghijklmnop",
"cache-control: no-cache",
"postman-token: wt53gwg-e9bb-645d-g53d-e42f8765aut0"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}