mirror of
https://github.com/lidarr/Lidarr
synced 2025-01-03 13:34:54 +00:00
Check Content-Type in FileList parser
This commit is contained in:
parent
af08ba4bd7
commit
777934639f
1 changed files with 7 additions and 2 deletions
|
@ -18,8 +18,6 @@ public FileListParser(FileListSettings settings)
|
|||
|
||||
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
||||
{
|
||||
var torrentInfos = new List<ReleaseInfo>();
|
||||
|
||||
if (indexerResponse.HttpResponse.StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
throw new IndexerException(indexerResponse,
|
||||
|
@ -27,6 +25,13 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
|||
indexerResponse.HttpResponse.StatusCode);
|
||||
}
|
||||
|
||||
if (!indexerResponse.HttpResponse.Headers.ContentType.Contains(HttpAccept.Json.Value))
|
||||
{
|
||||
throw new IndexerException(indexerResponse, "Unexpected response header {0} from indexer request, expected {1}", indexerResponse.HttpResponse.Headers.ContentType, HttpAccept.Json.Value);
|
||||
}
|
||||
|
||||
var torrentInfos = new List<ReleaseInfo>();
|
||||
|
||||
var queryResults = JsonConvert.DeserializeObject<List<FileListTorrent>>(indexerResponse.Content);
|
||||
|
||||
foreach (var result in queryResults)
|
||||
|
|
Loading…
Reference in a new issue