Simplified encoding query

This commit is contained in:
ByteHamster 2019-07-12 15:28:33 +02:00
parent 3962fdd6f8
commit cbf3a2102f
1 changed files with 2 additions and 4 deletions

View File

@ -31,14 +31,12 @@ public class ItunesPodcastSearcher implements PodcastSearcher {
public Single<List<PodcastSearchResult>> search(String query) {
return Single.create((SingleOnSubscribe<List<PodcastSearchResult>>) subscriber -> {
String encodedQuery = null;
String encodedQuery;
try {
encodedQuery = URLEncoder.encode(query, "UTF-8");
} catch (UnsupportedEncodingException e) {
// this won't ever be thrown
}
if (encodedQuery == null) {
encodedQuery = query; // failsafe
encodedQuery = query;
}
String formattedUrl = String.format(ITUNES_API_URL, encodedQuery);