Android Retrofit2 设置请求头Header
@Headers设置固定请求头
public interface HttpService {
@Headers({
"header1:headerValue1",
"header2:headerValue2",
"header3:headerValue3",
})
@POST("Login")
Call<Account> login(@Body ReqLogin body);
}
@Header设置上可变请求头
public interface HttpService {
@POST("login")
Call<Account> login(@Body ReqLogin body, @Header("token") String token);
}