Body of Http.DELETE request in Angular2

前端 未结 12 1986
旧巷少年郎
旧巷少年郎 2020-12-02 08:23

I\'m trying to talk to a somewhat RESTful API from an Angular 2 frontend.

To remove some item from a collection, I need to send some other data in addition to the re

12条回答
  •  情歌与酒
    2020-12-02 09:23

    deleteInsurance(insuranceId: any) {
        const insuranceData = {
          id : insuranceId
        }
        var reqHeader = new HttpHeaders({
                "Content-Type": "application/json",
            });
            const httpOptions = {
                headers: reqHeader,
                body: insuranceData,
            };
        return this.http.delete(this.url + "users/insurance", httpOptions);
        }
    

提交回复
热议问题