mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-27 22:56:45 -04:00
Fixed: Removing torcache url query params to avoid redirect.
fixes #799 Removing query param was cleaner coz it avoids spoofing the referrer.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Http;
|
||||
using NzbDrone.Test.Common;
|
||||
using FluentAssertions;
|
||||
|
||||
namespace NzbDrone.Core.Test.Http
|
||||
{
|
||||
[TestFixture]
|
||||
public class TorCacheHttpRequestInterceptorFixture : TestBase<TorCacheHttpRequestInterceptor>
|
||||
{
|
||||
[Test]
|
||||
public void should_remove_query_params_from_torcache_request()
|
||||
{
|
||||
var request = new HttpRequest("http://torcache.net/download/123.torrent?title=something");
|
||||
|
||||
var newRequest = Subject.PreRequest(request);
|
||||
|
||||
newRequest.Url.AbsoluteUri.Should().Be("http://torcache.net/download/123.torrent");
|
||||
}
|
||||
|
||||
[TestCase("http://site.com/download?url=torcache.net&blaat=1")]
|
||||
[TestCase("http://torcache.net.com/download?url=123")]
|
||||
public void should_not_remove_query_params_from_other_requests(string url)
|
||||
{
|
||||
var request = new HttpRequest(url);
|
||||
|
||||
var newRequest = Subject.PreRequest(request);
|
||||
|
||||
newRequest.Url.AbsoluteUri.Should().Be(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user