-
Retrofit2 + RxJava 에서 Header 가져오기Android 2020. 12. 6. 17:16반응형
서버와 통신을 할때 header에 있는 토큰을 가져와야 할때가 있다.
POST("/register") fun registerUser(@Body registerPostData: RegistrationForm): Single<RegistrationResponse>
보통 통신을 할때 반환을 보통 위에 처럼 하는데
POST("/register") fun registerUser(@Body registerPostData: RegistrationForm): Single<Response<RegistrationResponse>>
반환 타입에 Response로 감싸주면 header를 가져 올 수 있게 된다.
반응형'Android' 카테고리의 다른 글
[Android] 카카오 로그인 v2 API with kotlin - 2 (0) 2020.12.24 [Android] TextView 부분 글자 바꾸기 (Span) (0) 2020.12.14 [Android] 파일 공유 대응 방법(File Provider) (0) 2020.11.13 [Android] 카카오 로그인 v2 API with kotlin - 1 (0) 2020.10.16 Fragment 통신 (setTargetFragment, Listener) (0) 2020.10.07