【发布时间】:2020-05-25 04:40:56
【问题描述】:
我正在尝试以角度提出此请求:
curl --location --request GET 'http://localhost:5000/location/searchDistanceAndTags?pageNo=1&size=1' \
--header 'token: $IKFASOmV#*+JIL4X0FGTDZNRPB3GN7HvAB9QD2X8QWeLsqtKW1U5YHnxCMRywEbUZlu??oz!!!!6r' \
--header 'Content-Type: application/json' \
--data-raw '{
"lat": "38.8993487",
"lng": "-77.0145665",
"radius": "100",
"tags": ["bier"]
}'
这是我的 Angular 代码,不幸的是,未设置参数(后端未在 req.body 中接收任何数据)
const dataset = {
lat: '38.8993487',
lng: '-77.0145665',
radius: '100',
tags: ['bier']
};
return this._httpClient.get<any>(`http://localhost:5000/location/searchDistanceAndTags?pageNo=${this.pageNumber}&size=10`, {
headers: {token: this.apikey,
'Content-Type': 'application/json'},
params: dataset
});
【问题讨论】:
-
这是获取方法。你的身体是什么意思?您不能使用 get 方法从正文发送
标签: angular httpclient