我的服务是:
getToken(){
var data = "grant_type=password&username=" + "username" + "&password=" + "yTX7W0s1zYxbJJT3+pXtJA==";
return this.http.post<any>('http://localhost:51643/token', data).pipe(map(res =>res))
}
在我的心情里
constructor(private data: PostaserviceService) { }
ngOnInit() {
this.data.getToken().pipe().subscribe(res => {
console.log(res);
});
}
我有一个错误:
http://localhost:51643/token
400(错误请求)
ERROR HttpErrorResponse{头:HttpHeaders,状态:400,状态文本:“错误请求”,url:“
http://localhost:51643/令牌
“,确定:错误,}