use of okhttp3.FormBody.Builder in project DevRing by LJYcoder.
the class HttpHeaderInterceptor method intercept.
@Override
public Response intercept(Chain chain) throws IOException {
Request originalRequest = chain.request();
Request.Builder builder = originalRequest.newBuilder();
for (Map.Entry<String, String> entry : mMapHeader.entrySet()) {
builder.header(entry.getKey(), entry.getValue());
}
Request.Builder requestBuilder = builder.method(originalRequest.method(), originalRequest.body());
Request request = requestBuilder.build();
return chain.proceed(request);
}
use of okhttp3.FormBody.Builder in project bugzy by cpunq.
the class NetModule method provideFogBugzService.
@Provides
@Singleton
FogbugzApiService provideFogBugzService(Application application, PrefsHelper prefsHelper, Gson gson) {
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
Retrofit.Builder builder = new Retrofit.Builder().baseUrl(mBaseUrl).addCallAdapterFactory(new LiveDataCallAdapterFactory(gson)).addConverterFactory(GsonConverterFactory.create(gson));
Retrofit retrofit = builder.client(httpClient.addInterceptor(new ConnectivityInterceptor(application.getApplicationContext())).addInterceptor(new RequestInterceptor(prefsHelper)).build()).build();
return retrofit.create(FogbugzApiService.class);
}
Aggregations