当我尝试执行我的请求时,这给了我一个错误 400,但我认为我正确设置了我的正文和标题。
示例:
pm.sendRequest({
url: 'https://' + pm.environment.get('oauth_server') +'/auth/oauth/v2/token',
method: 'POST',
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
body: {
"grant_type": "password",
"username": pm.environment.get('username'),
"password": pm.environment.get('password'),
"client_secret": pm.environment.get('oauth_clientsecret'),
"client_id": pm.environment.get('oauth_clientId')
}
}, function (err, res) {
console.log(res);
pm.globals.set('token', res.access_token);
pm.globals.set('refresh_token', res.refresh_token);
});