My script that shall do the work:
updateTask(task:Task){
const body = task;
var headers = new HttpHeaders();
headers.set('Content-Type', 'application/javascript');
headers.set('If-Match', task.etag);
return this.httpc.put(this.resources+'/'+task.id, body, { headers: headers });
}
Could anyone take a look at it and tell me if I did something wrong here please? Never tried it before, actually I am beginner to angular :S ( Back-end is not mine so I can't share with you guys :/ )
httpc is a HttpClient :) Thanks your time and answers in advance! ^^.
Edit 1:
Response > {"error":"If-Match header is missing or invalid"}
Edit2:
Request header
PUT /app/data/schedule/tasks/42615 HTTP/1.1
Host: localhost:3000
Connection: keep-alive
Content-Length: 438
Accept: application/json, text/plain, */*
Origin: http://localhost:3000
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36
Content-Type: application/json
Referer: http://localhost:3000/portal/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cookie: sid=f5eb691a56bfa7b6db05083023c5f4caf044db47c2f29f644bc80d7bb7dcf1f3