【发布时间】:2020-03-05 13:15:36
【问题描述】:
我正在将我的 Angular 应用程序包从 @angular/http 更新为 @angular/common/http。 在此过程中,由于以下原因,我的代码正在中断
在当前版本中,我可以通过以下方式发送表单数据和请求正文
this.http.post(URL, formData, {'header': headerObj, 'body': bodyObj})
但在升级中我只能发送formData 或body 不能同时发送
this.httpClient.post(this.hostname + apiURL, formData, options)
我不想将请求正文转换为 formData 对象,因为我会将 null 或 undefined 发送到服务器,服务器会转换为我不想要的字符串 null。
有解决办法吗?
【问题讨论】:
标签: angular httpclient