mirror of https://github.com/readrops/Readrops.git
If a response doesn't have a content-type header, throw UnknownFormatException instead of ParseException
This commit is contained in:
parent
ec53cbd683
commit
6874ef2452
|
@ -140,7 +140,7 @@ class LocalRSSDataSourceTest {
|
|||
localRSSDataSource.queryRSSResource(url.toString(), null)
|
||||
}
|
||||
|
||||
@Test(expected = ParseException::class)
|
||||
@Test(expected = UnknownFormatException::class)
|
||||
fun noContentTypeTest() {
|
||||
mockServer.enqueue(MockResponse().setResponseCode(HttpURLConnection.HTTP_OK))
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class LocalRSSDataSource(private val httpClient: OkHttpClient) {
|
|||
return when {
|
||||
response.isSuccessful -> {
|
||||
val header = response.header(LibUtils.CONTENT_TYPE_HEADER)
|
||||
?: throw ParseException("Unable to get $url content-type")
|
||||
?: throw UnknownFormatException("Unable to get $url content-type")
|
||||
|
||||
val contentType = LibUtils.parseContentType(header)
|
||||
?: throw ParseException("Unable to parse $url content-type")
|
||||
|
|
Loading…
Reference in New Issue