1313import engineer .nightowl .sonos .api .util .SonosUtilityHelper ;
1414import org .apache .commons .io .IOUtils ;
1515import org .apache .http .Header ;
16- import org .apache .http .client .methods .*;
16+ import org .apache .http .client .methods .CloseableHttpResponse ;
17+ import org .apache .http .client .methods .HttpDelete ;
18+ import org .apache .http .client .methods .HttpGet ;
19+ import org .apache .http .client .methods .HttpPost ;
20+ import org .apache .http .client .methods .HttpRequestBase ;
21+ import org .apache .http .client .methods .HttpUriRequest ;
1722import org .apache .http .client .utils .URIBuilder ;
23+ import org .apache .http .entity .ContentType ;
1824import org .apache .http .entity .StringEntity ;
1925import org .slf4j .Logger ;
2026import org .slf4j .LoggerFactory ;
2127
2228import java .io .IOException ;
2329import java .io .InputStream ;
24- import java .io .UnsupportedEncodingException ;
2530import java .net .URISyntaxException ;
2631
2732/**
@@ -37,6 +42,7 @@ class BaseResource
3742 .setSerializationInclusion (JsonInclude .Include .NON_NULL );
3843 /**
3944 * Sonos can provide a header describing the response type
45+ *
4046 * @see engineer.nightowl.sonos.api.enums.SonosType
4147 */
4248 private static final String SONOS_TYPE_HEADER = "X-Sonos-Type" ;
@@ -232,8 +238,8 @@ <T, U> T postToApi(final Class<T> returnType, final String token, final String p
232238 try
233239 {
234240 json = OM .writeValueAsString (content );
235- requestContent = new StringEntity (json );
236- } catch (final JsonProcessingException | UnsupportedEncodingException e )
241+ requestContent = new StringEntity (json , ContentType . APPLICATION_JSON );
242+ } catch (final JsonProcessingException e )
237243 {
238244 throw new SonosApiClientException ("Unable to convert POST request parameters" , e );
239245 }
0 commit comments