내가 응답을 받으면 성공 클래스가 완벽하게 작동합니다. 그러나 실패하면 오류가 발생했습니다.
URL에서 데이터 전달 실패시 응답 :
{
"success": -1,
"message": "Invalid username or password",
"data": ""
}
URL에서 올바른 데이터 전달시 응답 :
{
"success": 1,
"message": "User successfully logged in",
"data": {
"userId": 219,
"userName": "mp",
"picture": "219.png",
"isBo": false,
"isPo": true,
"isHm": true,
"hmProfileCompletionStatus": 3,
"poProfileCompletionStatus": 2,
"poPhoto": null,
"hmPhoto": null,
"custStripeToken": "xxx",
"accountStripeToken": "xx",
"bgcStatus": true,
"idCardStatus": true,
"isInsured": null,
"amISponsered": false,
"hmRating": null,
"poRating": null,
"email": "[email protected]"
}
}
UserResponse.java
@Getter
@Setter
public class UserResponse{
private int success;
private String message;
private User data;
}
오류
java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 64 path $.data
불가능합니다. 귀하의 경우에는 다음과 같아야합니다
{
"success": -1,
"message": "Invalid username or password",
"data": {}
}
백엔드 서비스 팀에 동일한 응답 객체를 다시 사용할 수 있도록 빈 객체로 변경하도록 요청하세요.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다