I have an endpoint that receives a JSON request through POST.
RequestMapping(value = "/app/login", method = RequestMethod.POST,
headers = { "Content-type=application/json" })
@ResponseBody
public LoginResponse logIn(@RequestBody LoginRequest jsonRequest) {
}
LoginRequest:
public class LoginRequest {
private String user;
private String password;
private String idPush;
private Integer idDevice;
}
Anyway, can I specify idDevice as optional?
If I do not send idDevice inside json, Spring returns a 400 error.
source
share