Sending data with Retrofit

Sending data with Retrofit

Need to hire an app developer?

Post your project

in 5 minutes for free

Re: Sending data with Retrofit

on Android Developers at Jan 09, 2018 18:30

JakeWharton commented on Jan 29, 2016
Retrofit is not going to implement this, because it's basically a pathway to becoming our own object serializer which is not something that we want to embed. Even a simple version of this would quickly devolve into the large mechanics needed for proper serialization customization. We already border on that with just the parameters and return type.

That said, there's one pathway to doing this yourself currently and one that will be added in the future:

The first is by registering a Converter.Factory which provides a stringConverter for these types. It would need to be used with @Query(encoded=true) so that things like & work properly in the final URL.

The second is with #626 which will allow custom hookups of annotations to the underlying RequestBuilder. This will allow you to create @QueryObject which actually calls addQueryParam directly for each field. This is a post-2.0 feature, however.

https://github.com/square/retrofit/issues/1503

Re: Sending data with Retrofit

on Android Developers at Jan 09, 2018 18:33

did you try this?
https://github.com/square/retrofit/issues/1503

according to the author of retrofit,

"That said, there's one pathway to doing this yourself currently and one that will be added in the future:

The first is by registering a Converter.Factory which provides a stringConverter for these types. It would need to be used with @Query(encoded=true) so that things like & work properly in the final URL.

The second is with #626 which will allow custom hookups of annotations to the underlying RequestBuilder. This will allow you to create @QueryObject which actually calls addQueryParam directly for each field. This is a post-2.0 feature, however."
Reply on this threadPost a reply
Loading...
Advertisement