post请求类型默认就是formdata你的Content-Type后面没有boundary 尝试使用post默认请求类型(即不设置Content-type),如下这样 constructor(private http: HttpClient) { this.baseUrl = `${BASE_URL}/api/visitors`; } visitor(id:string) { let data = new FormData(); data.append('id', id); this.http.post(`${this.baseUrl}/myapi`, data).subscribe(); }
post
请求类型默认就是formdata
你的
Content-Type
后面没有boundary
尝试使用
post
默认请求类型(即不设置Content-type),如下这样