forked from Fascinated/Bat
add spotify feature
This commit is contained in:
@ -27,14 +27,15 @@ public class WebRequest {
|
||||
* Gets a response from the given URL.
|
||||
*
|
||||
* @param url the url
|
||||
* @return the response
|
||||
* @param <T> the type of the response
|
||||
* @return the response
|
||||
*/
|
||||
public static <T> T getAsEntity(String url, Class<T> clazz) throws RateLimitException {
|
||||
ResponseEntity<T> responseEntity = CLIENT.get()
|
||||
.uri(url)
|
||||
.retrieve()
|
||||
.onStatus(HttpStatusCode::isError, (request, response) -> {}) // Don't throw exceptions on error
|
||||
.onStatus(HttpStatusCode::isError, (request, response) -> {
|
||||
}) // Don't throw exceptions on error
|
||||
.toEntity(clazz);
|
||||
|
||||
if (responseEntity.getStatusCode().isError()) {
|
||||
@ -56,7 +57,8 @@ public class WebRequest {
|
||||
return CLIENT.get()
|
||||
.uri(url)
|
||||
.retrieve()
|
||||
.onStatus(HttpStatusCode::isError, (request, response) -> {}) // Don't throw exceptions on error
|
||||
.onStatus(HttpStatusCode::isError, (request, response) -> {
|
||||
}) // Don't throw exceptions on error
|
||||
.toEntity(clazz);
|
||||
}
|
||||
|
||||
@ -70,7 +72,8 @@ public class WebRequest {
|
||||
return CLIENT.head()
|
||||
.uri(url)
|
||||
.retrieve()
|
||||
.onStatus(HttpStatusCode::isError, (request, response) -> {}) // Don't throw exceptions on error
|
||||
.onStatus(HttpStatusCode::isError, (request, response) -> {
|
||||
}) // Don't throw exceptions on error
|
||||
.toEntity(clazz);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user