Simplified encoding query
This commit is contained in:
parent
3962fdd6f8
commit
cbf3a2102f
|
@ -31,14 +31,12 @@ public class ItunesPodcastSearcher implements PodcastSearcher {
|
||||||
|
|
||||||
public Single<List<PodcastSearchResult>> search(String query) {
|
public Single<List<PodcastSearchResult>> search(String query) {
|
||||||
return Single.create((SingleOnSubscribe<List<PodcastSearchResult>>) subscriber -> {
|
return Single.create((SingleOnSubscribe<List<PodcastSearchResult>>) subscriber -> {
|
||||||
String encodedQuery = null;
|
String encodedQuery;
|
||||||
try {
|
try {
|
||||||
encodedQuery = URLEncoder.encode(query, "UTF-8");
|
encodedQuery = URLEncoder.encode(query, "UTF-8");
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
// this won't ever be thrown
|
// this won't ever be thrown
|
||||||
}
|
encodedQuery = query;
|
||||||
if (encodedQuery == null) {
|
|
||||||
encodedQuery = query; // failsafe
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String formattedUrl = String.format(ITUNES_API_URL, encodedQuery);
|
String formattedUrl = String.format(ITUNES_API_URL, encodedQuery);
|
||||||
|
|
Loading…
Reference in New Issue