Use Newtonsoft.Json for UploadToLinuxPackageRepository (#7745)

This commit is contained in:
William Lee 2017-10-02 16:39:37 -07:00 committed by GitHub
parent 3cebbb4ea3
commit 85ce73dfb5
2 changed files with 6 additions and 6 deletions

View file

@ -8,7 +8,7 @@ using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using NuGet.Protocol;
using Newtonsoft.Json;
namespace Microsoft.DotNet.Cli.Build.UploadToLinuxPackageRepository
{
@ -34,13 +34,13 @@ namespace Microsoft.DotNet.Cli.Build.UploadToLinuxPackageRepository
public async Task<string> Execute(HttpClient client, Uri baseAddress)
{
var debianUploadJsonContent = new Dictionary<string, string>
var debianUploadJsonContent = JsonConvert.SerializeObject(new Dictionary<string, string>
{
["name"] = _packageName,
["version"] = AppendDebianRevisionNumber(_packageVersion),
["fileId"] = _idInRepositoryService.Id,
["repositoryId"] = _repositoryId
}.ToJson();
});
var content = new StringContent(debianUploadJsonContent,
Encoding.UTF8,
"application/json");
@ -49,7 +49,7 @@ namespace Microsoft.DotNet.Cli.Build.UploadToLinuxPackageRepository
{
if (!response.IsSuccessStatusCode)
throw new FailedToAddPackageToPackageRepositoryException(
$"request:{debianUploadJsonContent} response:{response.ToJson()}");
$"request:{debianUploadJsonContent} response:{JsonConvert.SerializeObject(response)}");
return response.Headers.GetValues("Location").Single();
}
}