【发布时间】:2020-06-26 19:01:17
【问题描述】:
我在我的 Angular 应用程序上使用了一个 restful api。
forgotPassword(mail: string) {
const apiURL = 'https://myapiendpoint';
const connect = this.httpClient.post(apiURL, { email: mail },
{ headers: {
'Content-type': 'application/json',
responseType: 'text'
}
});
return connect.toPromise();
}
API 被调用没有问题,但我无法从服务器获得响应。 创建 API 的人说他可以看到:
在收到响应之前关闭消息端口
有什么建议吗?
谢谢
【问题讨论】:
-
您订阅此请求的代码部分在哪里?
-
像这样简单订阅 POST 请求 Observable.httpClient.post(apiURL, { email: mail }).subscribe();
标签: angular httpclient