I am trying to make a patch/and post call to the server but it never gets to the server. I have tried doing this with postman and it works there. so I'm pretty sure its something with my code.
Basically, my post and patch are the same so i will only show the patch.
protected patch(url: string, body: any): Observable<any> {
let options = this.getRequestOptions(body);
return this.http.patch(this.baseUrl+url,JSON.stringify(body),options);
}
private getRequestOptions(body:any):RequestOptions{
let cpHeaders = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: cpHeaders });
return options;
}
please note that this.baseUrl = "http://localhost/blah/api/
and url is being passed in as test
;
I would appreciate any help here. thanks in advance
Update
[HttpPut]
public virtual IHttpActionResult Patch([FromBody]T entity)
{
return Ok(_repository.Patch(entity));
}
[HttpPatch]
public virtual IHttpActionResult WebPatch([FromBody]T entity)
{
return this.Patch(entity);
}
I have a proxy config as subjected in comments below.
{
"/api": {
"target": "http://localhost/QuickQuoteApi",
"secure": false,
"pathRewrite": {
"^/api": ""
}
}
}