Created
April 18, 2017 21:06
-
-
Save tonycosentini/d22f05431af34123ef725a5d4cf08e59 to your computer and use it in GitHub Desktop.
Retrofit bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RxJava { | |
public static void main(String[] args) { | |
Retrofit retrofit = new Retrofit.Builder() | |
.baseUrl("https://google.com/") | |
.addCallAdapterFactory(RxJavaCallAdapterFactory.createAsync()) | |
.build(); | |
Service service = retrofit.create(Service.class); | |
Subscription subscription = service.dummyApiCall() | |
.toSingle() | |
.subscribe(new Observer<Response<Void>>() { | |
@Override | |
public void onCompleted() { | |
System.out.println("Complete"); | |
} | |
@Override | |
public void onError(Throwable throwable) { | |
throwable.printStackTrace(); | |
} | |
@Override | |
public void onNext(Response<Void> voidResponse) { | |
System.out.println(voidResponse.code()); | |
} | |
}); | |
} | |
public interface Service { | |
@GET("/") | |
Observable<Response<Void>> dummyApiCall(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment