错误的请求400 JSON分析错误

时间:2018-07-11 09:51:07

标签: angular spring-boot

在前端

  this.reservationService.createReservation(this.reservation).subscribe(res => {
    console.log(res);
  });

this.reservation是ReservationD类型

export class ReservationDto {
    email: string;
    firstName: string;
    lastName: string;
    phoneNumber: string;
    reservationDate: string;
    id_seance: number;
    user_id: number;
}

在服务器端

@RequestMapping(value = "/createEvent", method = RequestMethod.POST)
public @ResponseBody
Reservation createReservation(@RequestBody ReservationDTO reservationDTO) {
    return reservationService.createReservation(reservationDTO);
}

当我请求我有错误

Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unrecognized token 'function': was expecting 'null', 'true', 'false' or NaN; nested exception is com.fasterxml.jackson.core.JsonParseException:

请求有效载荷如下

function ReservationDto() {
}

为什么有效载荷具有表格功能和 身体看起来应该如何?

0 个答案:

没有答案