0
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request.Builder requestBuilder = chain.request().newBuilder();
requestBuilder.header("Content-Type", "application/x-www-form-urlencoded");
requestBuilder.header("Accept", "text/json");
requestBuilder.header("Authorization","Basic fh73hf78fhhf7at"); }).build();
Retrofit retrofit = new Retrofit.Builder().baseUrl(BASE_URL).client(client).addConverterFactory(GsonConv erterFactory.create()).build();
BetaAPI betaAPI = retrofit.create(BetaAPI.class);
콘텐츠 유형 x-www-form-urlencoded의 원시 문자열을 추가 장착하는 방법은 무엇입니까? 개조 의 인터페이스 그래서
@POST("core/connect/userinfo")
Call<ResponseBody> getLogin(@Body String params);
이것은 그렇게 할 방법이 아닙니다. 위에서 언급 한 방법은 작동하지 않습니다. –
공식 문서 참조 - http://square.github.io/retrofit/2.x/retrofit/ – SaravInfern