- 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).
- 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!
- 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.
- 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.
- Fix: Correctly log
nullrequest arguments forHEADERS_AND_ARGSlog level.
- 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.
- 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.
- 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.
- 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.
- 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.
- Fix:
@QueryMap,@EncodedFieldMap, and@FieldMapnow correctly detectMap-based parameter types.
- 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.
- 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.
- Fix: Respect connection and read timeouts on supplied
OkHttpClientinstances. - Fix: Ensure connection is closed on non-200 responses.
- New: Converter for Wire protocol buffers!
- 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.
- 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.
- 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.
- 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
- Fix: Correct bad regex behavior on Android.
Initial release.