| Retrofit 2.0.0 正式发布了,retrofit 是一个类型安全的 REST 客户端,用于 Android 平台。。 该版本的重点是提升扩展性,因此包含大量 API 的改动,与上一个版本不兼容。详细的变化请看这里。 与 Beta4 版本比较的改进包括: New: RxJavaCallAdapterFactorynow supports service methods which returnCompletablewhich
ignores and discards response bodies, if any.New: RxJavaCallAdapterFactorysupports supplying a defaultSchedulerwhich will be used
forsubscribeOnon returnedObservable,Single, andCompletableinstances.New: MoshiConverterFactorysupports creating an instance which uses lenient parsing.New: @Partcan omit the part name and use OkHttp'sMultipartBody.Parttype for supplying
parts. This lets you customize the headers, name, and filename and provide the part body in a
single argument.The BaseUrlinterface and support for changeable base URLs was removed. This functionality
can be done using an OkHttp interceptor and a sample showcasing it was added.Response.isSuccess()was renamed toResponse.isSuccessful()for parity with the name of
OkHttp's version of that method.
Fix: Throw a more appropriate exception with a message when a resolved url (base URL + relative
URL) is malformed.Fix: GsonConverterFactorynow honors settings on theGsoninstance (like leniency).Fix: ScalarsConverterFactorynow supports primitive scalar types in addition to boxed for
response body parsing.Fix: Retrofit.callbackExecutor()may now return an executor even when one was not explicitly
provided. This allows customCallAdapter.Factoryimplementations to use it when triggering
callbacks to ensure they happen on the appropriate thread for the platform (e.g., Android).
 下载地址:
 https://github.com/square/retrofit/releases/tag/parent-2.0.0 |