mirror of
https://github.com/fergalmoran/Readarr.git
synced 2026-01-02 23:04:23 +00:00
Fixed: Calibre authentication with Basic auth
This commit is contained in:
@@ -823,7 +823,7 @@ namespace NzbDrone.Common.Test.Http
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_correctly_use_basic_auth()
|
||||
public void should_correctly_use_basic_auth_with_basic_network_credential()
|
||||
{
|
||||
var request = new HttpRequest($"https://{_httpBinHost}/basic-auth/username/password");
|
||||
request.Credentials = new BasicNetworkCredential("username", "password");
|
||||
@@ -833,6 +833,17 @@ namespace NzbDrone.Common.Test.Http
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_correctly_use_basic_auth_with_network_credential()
|
||||
{
|
||||
var request = new HttpRequest($"https://{_httpBinHost}/basic-auth/username/password");
|
||||
request.Credentials = new NetworkCredential("username", "password");
|
||||
|
||||
var response = Subject.Execute(request);
|
||||
|
||||
response.StatusCode.Should().Be(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_correctly_use_digest_auth()
|
||||
{
|
||||
|
||||
@@ -68,8 +68,11 @@ namespace NzbDrone.Common.Http.Dispatchers
|
||||
else if (request.Credentials is NetworkCredential nc)
|
||||
{
|
||||
var creds = GetCredentialCache();
|
||||
creds.Remove((Uri)request.Url, "Digest");
|
||||
creds.Add((Uri)request.Url, "Digest", nc);
|
||||
foreach (var authtype in new[] { "Basic", "Digest" })
|
||||
{
|
||||
creds.Remove((Uri)request.Url, authtype);
|
||||
creds.Add((Uri)request.Url, authtype, nc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user