Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Add Synchronous Call Adapter #2186

Closed
jaredsburrows opened this issue Feb 2, 2017 · 1 comment
Closed

[Request] Add Synchronous Call Adapter #2186

jaredsburrows opened this issue Feb 2, 2017 · 1 comment

Comments

@jaredsburrows
Copy link
Contributor

jaredsburrows commented Feb 2, 2017

Problem:

From Retrofit 1:

interface Service {
   String someRequest();
}

For Retrofit 2, we are forced to use Call or some other call adapter such as Observable with RxJava/2 call adapters.

Question:

See http://stackoverflow.com/a/35104080, can we add a synchronous call adapter?

@JakeWharton
Copy link
Member

JakeWharton commented Feb 2, 2017

We very explicitly don't support this by default. Call was designed so that the interface could remain constant while allowing both synchronous and asynchronous invocation without needing the interface to change.

As the StackOverflow answer indicates, it's fairly easy to write your own adapter that provides the legacy behavior, although you miss out on things like the ability to cancel, see headers, get the error body, etc. These deficiencies plagued 1.x which is why we actively steer you away from it in 2.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants