0

Registering an InstanceCreator with Gson for this type may fix this problem.

Can some help me? I need to capture headers(Authorization Token) from Response.

val call: Call<GuestAuth> = api.getGuestAuthToken(AuthModel("guest"))

 call.enqueue(object : Callback<GuestAuth> {
                override fun onFailure(call: Call<GuestAuth>, t: Throwable) {
                    Log.e("retrofit", t.localizedMessage)
                }

                override fun onResponse(call: Call<GuestAuth>,response: Response<GuestAuth>) {
                    Log.e("retrofit", "OK")
                    data = response.body()
                    authorizationToken = response.headers().get("Authorization").toString()
                }
            })

none of the stack over flow previous questions help me :(

Sri
  • 1
  • 1
  • 3

1 Answers1

0

Maybe this thread helps you: https://github.com/square/retrofit/issues/3226

Please provide more details about your code.

Mahdi Rajabi
  • 582
  • 1
  • 4
  • 11