Ошибка Unexpected token N in JSON at position 0 at JSON.parse
Пробую передать из Spring Controller ResponseEntity в Angular приложение но получаю ошибку как в Заголовку
Controller:
@PutMapping(value = "/addFlight/{id}", produces = "application/json")
public ResponseEntity<String> addFlight(@PathVariable int id, @RequestBody FlightViewModel flightViewModel){
//Some code...
return new ResponseEntity<>("Some text", HttpStatus.OK)
}
В Angular Service:
addFlight(flight: IFlight, id: number, places: number): Observable<any> {
const body = {flight, places};
return this.http.put(this.ADD_FLIGH_URL + id, body);
}
Angular component:
public chooseFlight(flight: IFlight, id: number, places: string) {
this.touristService.addFlight(flight, id, Number.parseInt(places)).subscribe(
(res: Response) => {
if (res.ok){
console.log(res.body);
}else {
console.log(res.status);
}
},
error =>{
console.log(error);
}
);
}
В результате чего в консольке:
