Invoking cancel() will cancel in-flight requests or prevent the request from even being performed Request/response pair so it can only be used once, but you can clone() it for re-use. This allows them to be executed synchronously or asynchronously using the same method definition. For an explanation of this strategy, see Jake Wharton's post, Java Interoperability Policy for Major Version This should make it possible for large applications and libraries to migrate The API changes are numerous but solve shortcomings of the previous version and provide a path for future enhancement.īecause the release includes breaking API changes, we're changing the project's package name from retrofit to retrofit2. Retrofit 2 is a major release focused on extensibility. Fix: Honor backpressure in Observables created from the RxJavaCallAdapterFactory.New: Support iterable and array parameters using OkHttp's MultipartBody.Part.New: Support OkHttp's HttpUrl as a parameter type.Fix: Reduce the per-request allocation overhead for the RxJava call adapter.Fix: Pass the correct Call instance to Callback's onResponse and onFailure methods such that calling clone() retains the correct threading behavior.New: ProtoConverterFactory.createWithRegistry() method accepts an extension registry to be used when deserializing protos.Fix: Eagerly catch malformed Content-Type headers supplied via or ().They had the potential to be misleading and look like a library issue. Fix: Remove the stacktrace from fake network exceptions created from retrofit-mock's NetworkBehavior.Fix: Honor the Content-Type encoding of XML responses when deserializing response bodies.New: annotations on the parameter and on the method will be propagated to Moshi for creating the request and response adapters, respectively.New: annotation and support for supplying an arbitrary number of headers to an endpoint.Fix: Skip a UTF-8 BOM (if present) when using the converter for Moshi.This allows user converters to handle cases such as when annotating string parameters instead of them always using the raw Fix: Use supplied string converters for the String type on non-body parameters.Fix: Reflect the canceled state of the HTTP client's Call in Retrofit's Call.Fix: Close response on HTTP 204 and 205 to avoid resource leak.Remove explicit handling of the now-defunct RoboVM platform.This is a source-incompatible but binary-compatible change which is only relevant if you Promote the response body generic type on CallAdapter from the adapt method to the enclosing class.HttpException has been moved into the main artifact and should be used instead of the versions embedded in each adapter (which have been deprecated).New: NetworkBehavior now allows setting an error percentage and returns HTTP errors when triggered.New: Add createAsync() to RxJava 1.x call adapter factory which executes requests using Call.enqueue() using the underlying HTTP client's asynchronous support.New: The Moshi converter factory now offers methods for enabling null serialization and lenient parsing.New: Add toString() implementations for Response and Result.New: RxJava 1.x call adapter now correctly handles broken subscribers whose methods throw exceptions.New: Support for messages generated by Protobuf 3.0 or newer when using the converter for Google's protobuf. New: annotation allows creating a query parameter with no '=' separator or value.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |