diff --git a/corelibrary/src/main/java/com/pxs/corelibrary/corelib/http/RestCreator.java b/corelibrary/src/main/java/com/pxs/corelibrary/corelib/http/RestCreator.java index 9df7a2e..e88fced 100644 --- a/corelibrary/src/main/java/com/pxs/corelibrary/corelib/http/RestCreator.java +++ b/corelibrary/src/main/java/com/pxs/corelibrary/corelib/http/RestCreator.java @@ -15,13 +15,13 @@ import retrofit2.converter.scalars.ScalarsConverterFactory; -public final class RestCreator { +public class RestCreator { - private static final class RetrofitHolder { + private static class RetrofitHolder { - private static final String BASE_URL = ProjectInit.getConfiguration(ConfigKeys.API_HOST_SING); + private static String BASE_URL = ProjectInit.getConfiguration(ConfigKeys.API_HOST_SING); - private static final Retrofit RETROFIT_CLIENT = new Retrofit + private static Retrofit RETROFIT_CLIENT = new Retrofit .Builder() .baseUrl(BASE_URL) .addConverterFactory(ScalarsConverterFactory.create()) @@ -39,7 +39,7 @@ private static Retrofit RETROFIT_CUSTOM_INTERCEPTOR(Interceptor interceptor) { } //单独配置okhttp - private static final class OkHttpHolder { + private static class OkHttpHolder { private static final int TIME_OUT = 60; @@ -66,9 +66,9 @@ private static OkHttpClient OK_HTTP_CLIENT_INTERCEPTOR(Interceptor interceptor) } //提供一个接口让调用者得到retrofit对象 - private static final class RestServiceHolder { + private static class RestServiceHolder { - private static final RestService REST_SERVICE = RetrofitHolder.RETROFIT_CLIENT.create(RestService.class); + private static RestService REST_SERVICE = RetrofitHolder.RETROFIT_CLIENT.create(RestService.class); private static RestService getRestServiceInterceptor(Interceptor interceptor) { return RetrofitHolder.RETROFIT_CUSTOM_INTERCEPTOR(interceptor).create(RestService.class); diff --git a/corelibrary/src/main/java/com/pxs/corelibrary/corelib/http/RestService.java b/corelibrary/src/main/java/com/pxs/corelibrary/corelib/http/RestService.java index 95ee376..a28bada 100644 --- a/corelibrary/src/main/java/com/pxs/corelibrary/corelib/http/RestService.java +++ b/corelibrary/src/main/java/com/pxs/corelibrary/corelib/http/RestService.java @@ -20,7 +20,6 @@ public interface RestService { @GET Call get(@Url String url, @QueryMap Map params); - @Headers({"Content-Type: application/json", "Accept: application/json"}) @FormUrlEncoded @POST Call post(@Url String url, @FieldMap Map params); @@ -28,6 +27,10 @@ public interface RestService { @POST Call postRaw(@Url String url, @Body RequestBody params); + @Headers({"Content-Type: application/json", "Accept: application/json"}) + @POST + Call postMapRaw(@Url String url,@Body RequestBody params); + @Streaming @GET Call down(@Url String url);