【发布时间】:2018-01-10 21:07:09
【问题描述】:
我正在尝试使用不同线程的 http post 发送数据,但我做不到。 我需要发送这些数据,在邮递员中测试过。
标题。 内容类型:application/x-www-form-urlencoded 授权:基本用户:pass
身体。 授予类型:密码 范围:个人资料
这是我的代码。
login() {
let url = URL_LOGIN;
let headers = new Headers(
{
'Content-Type': 'application/json',
'Authorization': 'Basic user:pass'
});
let body = {
'grant_type': 'password',
'scope': 'profile'
}
return this.http.post(url, body, { headers: headers })
.map((response: Response) => {
var result = response.json();
return result;
})
}
提前致谢!!
【问题讨论】:
标签: javascript angular typescript ionic-framework http-headers