Skip to content

Commit

Permalink
Upgraded to latest RestSharp
Browse files Browse the repository at this point in the history
  • Loading branch information
midwan committed May 8, 2022
1 parent 761cb78 commit 0879eec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion MB_SubSonic/SubSonic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="RestSharp">
<Version>106.12.0</Version>
<Version>107.3.0</Version>
</PackageReference>
<PackageReference Include="System.ValueTuple">
<Version>4.5.0</Version>
Expand Down
12 changes: 6 additions & 6 deletions MB_SubSonic/Subsonic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -892,9 +892,9 @@ public static Exception GetError()
return _lastEx;
}

private static string SendRequest(IRestRequest request)
private static string SendRequest(RestRequest request)
{
var client = new RestClient {BaseUrl = new Uri(_serverName + "rest/")};
var client = new RestClient(_serverName + "rest/");
request.AddParameter("u", _currentSettings.Username);
if (_currentSettings.Auth == SubsonicSettings.AuthMethod.HexPass)
{
Expand All @@ -917,7 +917,7 @@ private static string SendRequest(IRestRequest request)

request.AddParameter("c", "MusicBee");

var response = client.Execute(request);
var response = client.ExecuteAsync(request).Result;
if (response.IsSuccessful) return response.Content;

const string message = "Error retrieving response from Subsonic server:";
Expand All @@ -928,9 +928,9 @@ private static string SendRequest(IRestRequest request)
return response.Content;
}

private static byte[] DownloadData(IRestRequest request)
private static byte[] DownloadData(RestRequest request)
{
var client = new RestClient {BaseUrl = new Uri(_serverName + "rest/")};
var client = new RestClient(_serverName + "rest/");
request.AddParameter("u", _currentSettings.Username);

if (_currentSettings.Auth == SubsonicSettings.AuthMethod.HexPass)
Expand All @@ -953,7 +953,7 @@ private static byte[] DownloadData(IRestRequest request)


request.AddParameter("c", "MusicBee");
var response = client.Execute(request);
var response = client.ExecuteAsync(request).Result;

if (!response.ContentType.StartsWith("text/xml")) return response.RawBytes;

Expand Down

0 comments on commit 0879eec

Please sign in to comment.