Change Log
Version 2.9.0 (2020-05-20)
-
New: RxJava 3 adapter!
The Maven coordinates are
com.squareup.retrofit2:adapter-rxjava3.Unlike the RxJava 1 and RxJava 2 adapters, the RxJava 3 adapter's
create()method will produce asynchronous HTTP requests by default. For synchronous requests usecreateSynchronous()and for synchronous on a scheduler usecreateWithScheduler(..).
Version 2.8.2 (2020-05-18)
- Fix: Detect running on the Android platform by using system property rather than the presence of classes. This ensures that even when you're running on the JVM with Android classes present on the classpath you get JVM semantics.
- Fix: Update to OkHttp 3.14.9 which contains an associated Android platform detection fix.
Version 2.8.1 (2020-03-25)
- Fix: Do not access
MethodHandles.Lookupon Android API 24 and 25. The class is only available on Android API 26 and higher.
Version 2.8.0 (2020-03-23)
- New: Add
Call.timeout()which returns theokio.Timeoutof the full call. - Fix: Change
Call.awaitResponse()to accept a nullable response type. - Fix: Support default methods on Java 14+. We had been working around a bug in earlier versions of Java. That bug was fixed in Java 14, and the fix broke our workaround.
Version 2.7.2 (2020-02-24)
- Fix: Update to OkHttp 3.14.7 for compatibility with Android R (API 30).
Version 2.7.1 (2020-01-02)
- Fix: Support 'suspend' functions in services interfaces when using 'retrofit-mock' artifact.
Version 2.7.0 (2019-12-09)
This release changes the minimum requirements to Java 8+ or Android 5+. See this blog post for more information on the change.
- New: Upgrade to OkHttp 3.14.4. Please see its changelog for 3.x.
- Fix: Allow service interfaces to extend other interfaces.
- Fix: Ensure a non-null body is returned by
Response.error.
Version 2.6.4 (2020-01-02)
- Fix: Support 'suspend' functions in services interfaces when using 'retrofit-mock' artifact.
Version 2.6.3 (2019-12-09)
- Fix: Change mechanism for avoiding
UndeclaredThrowableExceptionin rare cases from usingyieldan explicit dispatch which ensures that it will work even on dispatchers which do not support yielding.
Version 2.6.2 (2019-09-23)
- Fix: Avoid
IOExceptions being wrapped inUndeclaredThrowableExceptionin rare cases when usingResponse<..>as a return type for Kotlin 'suspend' functions.
Version 2.6.1 (2019-07-31)
- Fix: Avoid
IOExceptions being wrapped inUndeclaredThrowableExceptionin rare cases. - Fix: Include no-content
ResponseBodyfor responses created byResponse.error. - Fix: Update embedded R8/ProGuard rules to not warn about nested classes used for Kotlin extensions.
Version 2.6.0 (2019-06-05)
-
New: Support
suspendmodifier on functions for Kotlin! This allows you to express the asynchrony of HTTP requests in an idiomatic fashion for the language.@GET("users/{id}") suspend fun user(@Path("id") id: Long): User
Behind the scenes this behaves as if defined as
fun user(...): Call<User>and then invoked withCall.enqueue. You can also returnResponse<User>for access to the response metadata.Currently this integration only supports non-null response body types. Follow issue 3075 for nullable type support.
-
New:
@Tagparameter annotation for setting tags on the underlying OkHttpRequestobject. These can be read inCallAdapters or OkHttpInterceptors for tracing, analytics, varying behavior, and more. -
New:
@SkipCallbackExecutormethod annotation will result in yourCallinvoking itsCallbackon the background thread on which the HTTP call was made. -
New: Support OkHttp's
Headerstype for@HeaderMapparameters. -
New: Add
Retrofit.Builder.baseUrl(URL)overload. -
Fix: Add embedded R8/ProGuard rule which retains Retrofit interfaces (while still allowing obfuscation). This is needed because R8 running in 'full mode' (i.e., not in ProGuard-compatibility mode) will see that there are no subtypes of these interfaces and rewrite any code which references instances to null.
-
Fix: Mark
HttpException.response()as@Nullableas serializing the exception does not retain this instance. -
Fix: Fatal errors (such as stack overflows, out of memory, etc.) now propagate to the OkHttp
Dispatcherthread on which they are running. -
Fix: Ensure JAX-B converter closes the response body when an exception is thrown during deserialization.
-
Fix: Ignore static methods when performing eager validation of interface methods.
-
Fix: Ensure that calling
source()twice on theResponseBodypassed to aConverteralways returns the same instance. Prior to the fix, intermediate buffering would cause response data to be lost.
Version 2.5.0 (2018-11-18)
- New: Built-in support for Kotlin's
Unittype. This behaves the same as Java'sVoidwhere the body content is ignored and immediately discarded. - New: Built-in support for Java 8's
OptionalandCompletableFuturetypes. Previously the 'converter-java8' and 'adapter-java8' dependencies were needed and explicitly addingJava8OptionalConverterFactoryand/orJava8CallAdapterFactoryto yourRetrofit.Builderin order to use these types. Support is now built-in and those types and their artifacts are marked as deprecated. - New:
Invocationclass provides a reference to the invoked method and argument list as a tag on the underlying OkHttpCall. This can be accessed from an OkHttp interceptor for things like logging, analytics, or metrics aggregation. - New: Kotlin extension for
Retrofitwhich allows you callcreatepassing the interface type only as a generic parameter (e.g.,retrofit.create<MyService>()). - New: Added
Response.successoverload which allows specifying a custom 2xx status code. - New: Added
Calls.failureoverload which allows passing anyThrowablesubtype. - New: Minimal R8 rules now ship inside the jar requiring no client configuration in the common case.
- Fix: Do not propagate fatal errors to the callback. They are sent to the thread's uncaught exception handler.
- Fix: Do not enqueue/execute an otherwise useless call when the RxJava type is disposed by
onSubscribe. - Fix: Call
RxJavaPluginsassembly hook when creating an RxJava 2 type. - Fix: Ensure both the Guava and Java 8
Optionalconverters delegate properly. This ensures that converters registered prior to the optional converter can be used for deserializing the body type. - Fix: Prevent
@Pathvalues from participating in path-traversal. This ensures untrusted input passed as a path value cannot cause you to make a request to an un-intended relative URL. - Fix: Simple XML converter (which is deprecated) no longer wraps subtypes of
RuntimeExceptionorIOExceptionwhen it fails. - Fix: Prevent JAXB converter from loading remote entities and DTDs.
- Fix: Correctly detect default methods in interfaces on Android (API 24+). These still do not work, but now a correct exception will be thrown when detected.
- Fix: Report more accurate exceptions when a
@QueryNameor@QueryMapprecedes a@Urlparameter. - Update OkHttp dependency to 3.12.
Version 2.4.0 (2018-03-14)
- New:
Retrofit.Builderexposes mutable lists of the added converter and call adapter factories. - New: Call adapter added for Scala's
Future. - New: Converter for JAXB replaces the now-deprecated converter for Simple XML Framework.
- New: Add Java 9 automatic module names for each artifact corresponding to their root package.
- Fix: Do not swallow
Errors from callbacks (usuallyOutOfMemoryError). - Fix: Moshi and Gson converters now assert that the full response was consumed. This prevents hiding bugs in faulty adapters which might not have consumed the full JSON input which would then cause failures on the next request over that connection.
- Fix: Do not conflate OkHttp
Callcancelation with RxJava unsubscription/disposal. Prior to this change, canceling of aCallwould prevent a cancelation exception from propagating down the Rx stream.
Version 2.3.0 (2017-05-13)
-
Retrofit now uses
@Nullableto annotate all possibly-null values. We've added a compile-time dependency on the JSR 305 annotations. This is a provided dependency and does not need to be included in your build configuration,.jarfile, or.apk. We use@ParametersAreNonnullByDefaultand all parameters and return types are never null unless explicitly annotated@Nullable.Warning: this release is source-incompatible for Kotlin users. Nullability was previously ambiguous and lenient but now the compiler will enforce strict null checks.
-
New: Converters added for Java 8's and Guava's
Optionalwhich wrap a potentially-nullable response body. These converters still rely on normal serialization library converters for parsing the response bytes into an object. -
New: String converters that return
nullfor an@Queryor@Fieldparameter are now skipped. -
New: The mock module's
NetworkBehaviornow throws a custom subclass ofIOExceptionto more clearly indicate the exception's source. -
RxJava 1.x converter updated to 1.3.0 which stabilizes the use of
Completable. -
Fix: Add explicit handling for
OnCompleteFailedException,OnErrorFailedException, andOnErrorNotImplementedExceptionfor RxJava 1.x to ensure they're correct delivered to the plugins/hooks for handling. -
Fix:
NoSuchElementExceptionthrown when unsubscribing from an RxJava 1.xSingle.
Version 2.2.0 (2017-02-21)
- RxJava 2.x is now supported with a first-party 'adapter-rxjava2' artifact.
- New:
@QueryNameannotation allows creating a query parameter with no '=' separator or value. - New: Support for messages generated by Protobuf 3.0 or newer when using the converter for Google's protobuf.
- New: RxJava 1.x call adapter now correctly handles broken subscribers whose methods throw exceptions.
- New: Add
toString()implementations forResponseandResult. - New: The Moshi converter factory now offers methods for enabling null serialization and lenient parsing.
- New: Add
createAsync()to RxJava 1.x call adapter factory which executes requests usingCall.enqueue()using the underlying HTTP client's asynchronous support. - New:
NetworkBehaviornow allows setting an error percentage and returns HTTP errors when triggered. HttpExceptionhas been moved into the main artifact and should be used instead of the versions embedded in each adapter (which have been deprecated).- Promote the response body generic type on
CallAdapterfrom theadaptmethod to the enclosing class. This is a source-incompatible but binary-compatible change which is only relevant if you are implementing your ownCallAdapters. - Remove explicit handling of the now-defunct RoboVM platform.
- Fix: Close response on HTTP 204 and 205 to avoid resource leak.
- Fix: Reflect the canceled state of the HTTP client's
Callin Retrofit'sCall. - Fix: Use supplied string converters for the
Stringtype on non-body parameters. This allows user converters to handle cases such as when annotating string parameters instead of them always using the raw string. - Fix: Skip a UTF-8 BOM (if present) when using the converter for Moshi.
Version 2.1.0 (2016-06-15)
- New:
@HeaderMapannotation and support for supplying an arbitrary number of headers to an endpoint. - New:
@JsonAdapterannotations on the@Bodyparameter and on the method will be propagated to Moshi for creating the request and response adapters, respectively. - Fix: Honor the
Content-Typeencoding of XML responses when deserializing response bodies. - Fix: Remove the stacktrace from fake network exceptions created from retrofit-mock's
NetworkBehavior. They had the potential to be misleading and look like a library issue. - Fix: Eagerly catch malformed
Content-Typeheaders supplied via@Headeror@Headers.
Version 2.0.2 (2016-04-14)
- New:
ProtoConverterFactory.createWithRegistry()method accepts an extension registry to be used when deserializing protos. - Fix: Pass the correct
Callinstance toCallback'sonResponseandonFailuremethods such that callingclone()retains the correct threading behavior. - Fix: Reduce the per-request allocation overhead for the RxJava call adapter.
Version 2.0.1 (2016-03-30)
- New: Support OkHttp's
HttpUrlas a@Urlparameter type. - New: Support iterable and array
@Partparameters using OkHttp'sMultipartBody.Part. - Fix: Honor backpressure in
Observables created from the RxJavaCallAdapterFactory.
Version 2.0.0 (2016-03-11)
Retrofit 2 is a major release focused on extensibility. The API changes are numerous but solve shortcomings of the previous version and provide a path for future enhancement.
Because the release includes breaking API changes, we're changing the project's package name from
retrofit to retrofit2. This should make it possible for large applications and libraries to
migrate incrementally. The Maven group ID is now com.squareup.retrofit2. For an explanation of
this strategy, see Jake Wharton's post, Java Interoperability Policy for Major Version
Updates.
-
Service methods return
Call<T>. This allows them to be executed synchronously or asynchronously using the same method definition. ACallinstance represents a single request/response pair so it can only be used once, but you canclone()it for re-use. Invokingcancel()will cancel in-flight requests or prevent the request from even being performed if it has not already. -
Multiple converters for multiple serialization formats. API calls returning different formats (like JSON, protocol buffers, and plain text) no longer need to be separated into separate service interfaces. Combine them together and add multiple converters. Converters are chosen based on the response type you declare. Gson is no longer included by default, so you will always need to add a converter for any serialization support. OkHttp's
RequestBodyandResponseBodytypes can always be used without adding one, however. -
Call adapters allow different execution mechanisms. While
Callis the built-in mechanism, support for additional ones can be added similar to how different converters can be added. RxJava'sObservablesupport has moved into a separate artifact as a result, and support for Java 8'sCompletableFutureand Guava'sListenableFutureare also provided as additional artifacts. -
Generic response type includes HTTP information and deserialized body. You no longer have to choose between the deserialized body and reading HTTP information. Every
Callautomatically receives both via theResponse<T>type and the RxJava, Guava, and Java 8 call adapters also support it. -
@Url for hypermedia-like APIs. When your API returns links for pagination, additional resources, or updated content they can now be used with a service method whose first parameter is annotated with
@Url.
Changes from beta 4:
- 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).
Version 2.0.0-beta4 (2016-02-04)
- New:
Callinstance is now passed to bothonResponseandonFailuremethods ofCallback. This aids in detecting whenonFailureis called as a result ofCall.cancel()by checkingCall.isCanceled(). - New:
Call.request()returns (optionally creating) theRequestobject for the call. Note: If this is called beforeCall.execute()orCall.enqueue()this will do relatively expensive work synchronously. Doing so in performance-critical sections (like on the Android main thread) should be avoided. - New: Support for the release version of OkHttp 3.0 and newer.
- New:
adapter-guavamodule provides aCallAdapter.Factoryfor Guava'sListenableFuture. - New:
adapter-java8module provides aCallAdapter.Factoryfor Java 8'sCompleteableFuture. - New:
ScalarsConverterFactory(fromconverter-scalarsmodule) now supports parsing response bodies into eitherString, the 8 primitive types, or the 8 boxed primitive types. - New: Automatic support for sending callbacks to the iOS main thread when running via RoboVM.
- New: Method annotations are now passed to the factory for request body converters. This allows converters to alter the structure of both request bodies and response bodies with a single method-level annotation.
- Each converter has been moved to its own package under
retrofit2.converter.<name>. This prevents type collisions when many converters are simultaneously in use. - Fix: Exceptions thrown when unable to locate a
CallAdapter.Factoryfor a method return type now correctly list theCallAdapter.Factoryinstances checked. - Fix: Ensure default methods on service interfaces can be invoked.
- Fix: Correctly resolve the generic parameter types of collection interfaces when subclasses of those collections are used as method parameters.
- Fix: Do not encode
/characters in@Pathreplacements whenencoded = true.
Version 2.0.0-beta3 (2016-01-05)
- New: All classes have been migrated to the
retrofit2.*package name. The Maven groupId is nowcom.squareup.retrofit2. This is in accordance with the Java Interoperability Policy for Major Version Updates. With this change Retrofit 2.x can coexiest with Retrofit 1.x in the same project. - New: Update to use the OkHttp 3 API and OkHttp 3.0.0-RC1 or newer is now required. Similar to the previous
point, OkHttp has a new package name (
okhttp3.*) and Maven groupId (com.squareup.okhttp3) which allow it to coexist with OkHttp 2.x in the same project. - New: String converters allow for custom serialization of parameters that end up as strings (such as
@Path,@Query,@Header, etc.).Converter.Factoryhas a newstringConvertermethod which receives the parameter type and annotations and can return a converter for that type. This allows providing custom rendering of types likeDate,User, etc. to a string before being used for its purpose. A default converter will calltoString()for any type which retains the mimics the previous behavior. - New: OkHttp's
Call.Factorytype is now used as the HTTP client rather than using theOkHttpClienttype directly (OkHttpClientdoes implementCall.Factory). AcallFactorymethod has been added to bothRetrofit.BuilderandRetrofitto allow supplying alternate implementations of an HTTP client. Theclient(OkHttpClient)method onRetrofit.Builderstill exists as a convenience. - New:
isExecuted()method returns whether aCallhas been synchronously or asynchronously executed. - New:
isCanceled()method returns whether aCallhas been canceled. Use this inonFailureto determine whether the callback was invoked from cancellation or actual transport failure. - New:
converter-scalarsmodule provides aConverter.Factoryfor convertingString, the 8 primitive types, and the 8 boxed primitive types astext/plainbodies. Install this before your normal converter to avoid passing these simple scalars through, for example, a JSON converter. - New:
Converter.Factorymethods now receive aRetrofitinstance which also now has methods for querying the next converter for a given type. This allows implementations to delegate to others and provide additional behavior without complete reimplementation. - New:
@OPTIONSannotation more easily allows for making OPTIONS requests. - New:
@Partannotation now supportsListand array types. - New: The
@Urlannotation now allows usingjava.net.URIorandroid.net.Uri(in addition toString) as parameter types for providing relative or absolute endpoint URLs dynamically. - New: The
retrofit-mockmodule has been rewritten with a newBehaviorDelegateclass for implementing fake network behavior in a local mock implementation of your service endpoints. Documentation and more tests are forthcoming, but theSimpleMockServicedemonstrates its use for now. - Fix: Forbid Retrofit's
Responsetype and OkHttp'sResponsetype as the response body type given to aCall(i.e.,Call<Response>). OkHttp'sResponseBodytype is the correct one to use when the raw body contents are desired. - Fix: The Gson converter now respects settings on the supplied
Gsoninstance (such asserializeNulls). This requires Gson 2.4 or newer. - The Wire converter has been updated to the Wire 2.0 API.
- The change in 2.0.0-beta2 which provided the
Retrofitinstance to theonResponsecallback ofCallbackhas been reverted. There are too many edge cases around providing theRetrofitobject in order to allow deserialization of the error body. To accommodate this use case, pass around theRetrofitresponse manually or implement a customCallAdapter.Factorydoes so automatically.
Version 2.0.0-beta2 (2015-09-28)
- New: Using a response type of
Void(e.g.,Call<Void>) will ignore and discard the response body. This can be used when there will be no response body (such as in a 201 response) or whenever the body is not needed.@Headrequests are now forced to use this as their response type. - New:
validateEagerly()method onRetrofit.Builderwill verify the correctness of all service methods on calls tocreate()instead of lazily validating on first use. - New:
Converteris now parameterized over both 'from' and 'to' types with a singleconvertmethod.Converter.Factoryis now an abstract class and has factory methods for both request body and response body. - New:
Converter.FactoryandCallAdapter.Factorynow receive the method annotations when being created for a return/response type and the parameter annotations when being created for a parameter type. - New:
callAdapter()method onRetrofitallows querying aCallAdapterfor a given type. ThenextCallAdapter()method allows delegating to anotherCallAdapterfrom within aCallAdapter.Factory. This is useful for composing call adapters to incrementally build up behavior. - New:
requestConverter()andresponseConverter()methods onRetrofitallow querying aConverterfor a given type. - New:
onResponsemethod inCallbacknow receives theRetrofitinstance. Combined with theresponseConverter()method onRetrofit, this provides a way of deserializing an error body onResponse. See theDeserializeErrorBodysample for an example. - New: The
MoshiConverterFactoryhas been updated for its v1.0.0. - Fix: Using
ResponseBodyfor the response type orRequestBodyfor a parameter type is now correctly identified. Previously these types would erroneously be passed to the supplied converter. - Fix: The encoding of
@Pathvalues has been corrected to conform to OkHttp'sHttpUrl. - Fix: Use form-data content disposition subtype for
@Multipart. - Fix:
ObservableandSingle-based execution of requests now behave synchronously (and thus requiressubscribeOn()for running in the background). - Fix: Correct
GsonConverterFactoryto honor the configuration of theGsoninstances (such as not serializing null values, the default).
Version 2.0.0-beta1 (2015-08-27)
- New:
Callencapsulates a single request/response HTTP call. A call can by run synchronously viaexecute()or asynchronously viaenqueue()and can be canceled withcancel(). - New:
Responseis now parameterized and includes the deserialized body object. - New:
@Urlparameter annotation allows passing a complete URL for an endpoint. - New: OkHttp is now required as a dependency. Types like
TypedInputandTypedOutput(and its implementations),Request, andHeaderhave been replaced with OkHttp types likeRequestBody,ResponseBody, andHeaders. - New:
CallAdapter(andFactory) provides extension point for supporting multiple execution mechanisms. An RxJava implementation is provided by a sibling module. - New:
Converter(andFactory) provides extension point for supporting multiple serialization mechanisms. Gson, Jackson, Moshi, Protobuf, Wire, and SimpleXml implementations are provided by sibling modules. - Fix: A lot of things.
- Hello Droidcon NYC 2015!
Version 1.9.0 (2015-01-07)
- Update to OkHttp 2.x's native API. If you are using OkHttp you must use version 2.0 or newer (the latest
is 2.2 at time of writing) and you no longer need to use the
okhttp-urlconnectionshim. - New: Allow disabling Simple XML Framework's strict parsing.
- New:
@Headernow accepts aListor array for a type. - New:
@Fieldand@FieldMapnow have options for enabling or disabling URL encoding of names and values. - Fix: Remove query parameters from thread name when running background requests for asynchronous use.
Version 1.8.0 (2014-11-18)
- Update to RxJava 1.0. This comes with the project's 'groupId' change from
com.netflix.rxjavatoio.reactivexwhich is why the minor version was bumped.
Version 1.7.1 (2014-10-23)
- Fix: Correctly log
nullrequest arguments forHEADERS_AND_ARGSlog level.
Version 1.7.0 (2014-10-08)
- New:
RetrofitError'sgetKind()now disambiguates the type of error represented. - New:
HEADERS_AND_ARGSlog level displays parameters passed to method invocation along with normal header list. - New:
@Partand@PartMapnow support specifying theContent-Transfer-Encodingof their respective values. - New:
@Path,@Query, and@QueryMapnow have options for enabling or disabling URL encoding on names (where appropriate) and values. @Headernow accepts all object types, invokingString.valueOfwhen neccesary.- Attempting to use a
@Pathreplacement block ({name}) in a query parameter now suggested@Queryin the exception message. - Fix: Correct NPE when
Content-Typeoverride is specified on requests without a body. - Fix:
WireConverternow correctly throwsConversionExceptionon incorrect MIME types for parity withProtoConverter. - Fix: Include
Content-Typeon AppEngine requests. - Fix: Account for NPE on AppEngine when the response URL was not automatically populated in certain cases.
- Fix:
MockRestAdapter's RxJava support now correctly schedules work on the HTTP executor, specifically when chaining multiple requests together. - Experimental RxJava support updated for v0.20.
Version 1.6.1 (2014-07-02)
- Fix: Add any explicitly-specified 'Content-Type' header (via annotation or param) to the request even if there is no request body (e.g., DELETE).
- Fix: Include trailing CRLF in multi-part uploads to work around a bug in .NET MVC 4 parsing.
- Fix: Allow
nullmock exception bodies and use the success type from the declared service interface.
Version 1.6.0 (2014-06-06)
- New:
@Streamingon aResponsetype will skip buffering the body to abyte[]before delivering. - When using OkHttp, version 1.6.0 or newer (including 2.0.0+) is now required.
- The absence of a response body and an empty body are now differentiated in the log messages.
- Fix: If set, the
RequestInterceptoris now applied at the time ofObservablesubscription rather than at the time of its creation. - Fix:
Callbacksubtypes are now supported when usingMockRestAdapter. - Fix:
RetrofitErrornow contains a useful message indicating the reason for the failure. - Fix: Exceptions thrown when parsing the response type of the interface are now properly propagated.
- Fix: Calling
Response#getBodywhennullbody now correctly returns instead of throwing an NPE. - Experimental RxJava support updated for v0.19.
- The
Content-TypeandContent-Lengthheaders are no longer automatically added to the header list on theRequestobject. This reverts erroneous behavior added in v1.5.0. CustomClientimplementations should revert to adding these headers based on theTypedInputbody of theRequest.
Version 1.5.1 (2014-05-08)
- New:
@PartMapannotation accepts aMapof key/value pairs for multi-part. - Fix:
MockRestAdpateruses theErrorHandlerfrom its parentRestAdapter. - Experimental RxJava support updated for v0.18 and is now lazily initialized.
Version 1.5.0 (2014-03-20)
- New: Support for AppEngine's URL Fetch HTTP client.
- New: Multipart requests of unknown length are now supported.
- New: HTTP
Content-Typecan be overridden with a method-level or paramter header annotation. - New: Exceptions from malformed interface methods now include detailed information.
- Fix: Support empty HTTP response status reason.
- If an
ErrorHandleris supplied it will be invoked forCallbackandObservablemethods. - HTTP
PATCHmethod usingHttpUrlConnectionis no longer supported. Add the OkHttp jar to your project if you need this behavior. - Custom
Clientimplementations should no longer setContent-TypeorContent-Lengthheaders based on theTypedInputbody of theRequest. These headers will now be added automatically as part of the standardRequestheader list.
Version 1.4.1 (2014-02-01)
- Fix:
@QueryMap,@EncodedFieldMap, and@FieldMapnow correctly detectMap-based parameter types.
Version 1.4.0 (2014-01-31)
- New:
@Queryand@EncodedQuerynow acceptListor arrays for multiple values. - New:
@QueryMapand@EncodedQueryMapaccept aMapof key/value pairs for query parameters. - New:
@Fieldnow acceptsListor arrays for multiple values. - New:
@FieldMapaccepts aMapof name/value pairs for form URL-encoded request bodies. - New:
EndpointreplacesServeras the representation of the remote API root. TheEndpointsutility class contains factories methods for creating instances.ServerandChangeableServerare now deprecated. SimpleXmlConverterandJacksonConverternow have a default constructor.Responsenow includes the URL.- Fix: Hide references to optional classes to prevent over-eager class verifiers from complaining (e.g., Dalvik).
- Fix: Properly detect and reject interfaces which extend from other interfaces.
Version 1.3.0 (2013-11-25)
- New: Converter module for SimpleXML.
- New: Mock module which allows simulating real network behavior for local service interface implementations. See 'mock-github-client' example for a demo.
- New: RxJava
Observablesupport! Declare a return type ofObservable<Foo>on your service interfaces to automatically get an observable for that request. (Experimental API) - Fix: Use
ObjectMapper's type factory when deserializing (Jackson converter). - Multipart POST requests now stream their individual part bodies.
- Log chunking to 4000 characters now only happens on the Android platform.
Version 1.2.2 (2013-09-12)
- Fix: Respect connection and read timeouts on supplied
OkHttpClientinstances. - Fix: Ensure connection is closed on non-200 responses.
Version 1.2.1 (2013-08-30)
- New: Converter for Wire protocol buffers!
Version 1.2.0 (2013-08-23)
- New: Additional first-party converters for Jackson and Protocol Buffers! These are provided
as separate modules that you can include and pass to
RestAdapter.Builder'ssetConverter. - New:
@EncodedPathand@EncodedQueryannotations allow provided path and query params that are already URL-encoded. - New:
@PATCHHTTP method annotation. - Fix: Properly support custom HTTP method annotations in
UrlConnectionClient. - Fix: Apply
RequestInterceptorduring method invocation rather than at request execution time. - Change
setDebugtosetLogLevelonRestAdapterandRestAdapter.Builderand provide two levels of logging viaLogLevel. - Query parameters can now be added in a request interceptor.
Version 1.1.1 (2013-06-25)
- Fix: Ensure
@Headers-defined headers are correctly added to requests. - Fix: Supply reasonable connection and read timeouts for default clients.
- Fix: Allow passing
nullfor a@Part-annotated argument to remove it from the multipart request body.
Version 1.1.0 (2013-06-20)
- Introduce
RequestInterceptorto replaceRequestHeaders. An interceptor provided to theRestAdapter.Builderwill be called for every request and allow setting both headers and additional path parameter replacements. - Add
ErrorHandlerfor customizing the exceptions which are thrown when synchronous methods return non-200 error codes. - Properly parse responses which erroneously omit the "Content-Type" header.
Version 1.0.2 (2013-05-23)
- Allow uppercase letters in path replacement identifiers.
- Fix: Static query parameters in the URL are now correctly appended with a separating '?'.
- Fix: Explicitly allow or forbid
nullas a value for method parameters.@Path- Forbidden@Query- Allowed@Field- Allowed@Part- Forbidden@Body- Forbidden@Header- Allowed
Version 1.0.1 (2013-05-13)
- Fix: Correct bad regex behavior on Android.
Version 1.0.0 (2013-05-13)
Initial release.