http get
http post
set get var
urlencode
set header / param
// var host = pm.environment.get("var");
var host = '10*******:8081';
console.log(host);
// const csrfTokenServlet = {
// url: {{oauth-server}}/oauth2/v3/token?
,
// method: 'GET'
// };
const postRequest = {
url: http://${host}/${path}?
,
method: 'POST',
header:['Content-Type:application/x-www-form-urlencoded', 'Cookie:111111111'],
body: {
mode: 'x-www-form-urlencoded',
raw: "a=b&c=d"
}};
pm.sendRequest(postRequest, (err, response) => {
if (err) {
console.log(err);
} else {
pm.environment.set("at", response.json()['at']);
console.log(response.json()['at'])
}
});
pm.environment.set('at_url_encode', encodeURIComponent(pm.environment.get("at")));
// let paramValue = 'CwAAAAAAjZNgeYGiE***'
// pm.request.url.query.add('at=' + paramValue);
pm.request.url.query.add('at=' + pm.environment.get("at_url_encode"));
pm.request.headers.query.add('at=' + pm.environment.get("at_url_encode"));
网友评论