Here's a sample code of http request in Java:
URL url = new URL("http://example.com");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
What's the best way to combine HttpURLConnection
and RxJava
?
My current option is:
Observable.defer(() -> {
return sendHttpRequest(); // uses HttpURLConnection and returns a response's content as a string
});