Retrofit add header with token and id

我怕爱的太早我们不能终老 提交于 2019-12-03 17:03:37

I got it. It's must look like:

@GET("driver/v1/driver")
Call<Driver> getAuthorizedDriver(@Header("authorization") String auth);

And auth:

Call<Driver> call = apiInterface.getAuthorizedDriver("Token token=" + token + ", driver_id=" + id);

Try to pass the header values via the method call:

@GET("driver/v1/driver")
Call<Driver> getAuthorizedDriver(@Header("authorization") String token,
                                 @Header("driver_id") Integer id);

You also wouldn't have to deal with this huge chunk of Interceptor code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!