강의

멘토링

커뮤니티

Inflearn Community Q&A

jaeyoon1105's profile image
jaeyoon1105

asked

[Code Factory] [Intermediate] Flutter Real Practice! State Management, Cache Management, Code Generation, GoRouter, Authentication Logic, etc. Essential Skills to Become an Intermediate!

dio요청시 에러 상태코드임에도 onError가 아닌 onReponse에서 응답

Resolved

Written on

·

233

0

flutter: 
 [REQ] 
 [METHOD] GET 
 [ENDPOINT] http://localhost:8080/api/user/info
flutter: 
 [RES] 
 [METHOD] GET 
 [ENDPOINT] http://localhost:8080/api/user/info  
 [STATUS CODE] 401

현재 제가 진행 중인 프로젝트에서 401 코드임에도 불구하고 onError가 아닌 onReponse로 넘어갑니다.

 

액세스 토큰 재발급 과정을 onResponse에서 진행해도 되는걸까요?


    throw new InvalidVerificationCodeException(ErrorCode.INVALID_CODE);
}

백엔드에서 이렇게 에러를 내주는 onResponse로 넘어오네요..

flutter하이브리드-앱

Answer 2

0

codefactory님의 프로필 이미지
codefactory
Instructor

공유 감사합니다!

0

jaeyoon1105님의 프로필 이미지
jaeyoon1105
Questioner

 BaseOptions baseOptions = BaseOptions(
      validateStatus: (status) {
        return status! >= 200 && status < 500;
      },
      baseUrl: 'http://${EndPoint.ip}:8080',
    );

 

이 설정 때문에 response로 넘어간거였네요 🙉

jaeyoon1105's profile image
jaeyoon1105

asked

Ask a question