Skip to content

Commit

Permalink
Merge pull request #3 from jpeirson/bugfix/consumer-package-source
Browse files Browse the repository at this point in the history
Fixed missing dependentFeed/Url properties
  • Loading branch information
gdivis committed Jul 26, 2021
2 parents 14cfb7d + 163334e commit 3620609
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions pgscan/ProGetClient.cs
@@ -1,4 +1,5 @@
using System.IO;
using System;
using System.IO;
using System.Net;
#if NETCOREAPP3_1
using System.Text.Json;
Expand Down Expand Up @@ -33,12 +34,18 @@ public void RecordPackageDependency(Package package, string feed, PackageConsume
#if NETCOREAPP3_1
using (var writer = new Utf8JsonWriter(requestStream))
{
JsonSerializer.Serialize(writer, new DependentPackage(package, feed, consumer));
JsonSerializer.Serialize(writer, new DependentPackage(package, feed, consumer), new JsonSerializerOptions
{
IgnoreNullValues = true
});
}
#else
using (var writer = new StreamWriter(requestStream, Encoding.UTF8))
{
new JsonSerializer().Serialize(writer, new DependentPackage(package, feed, consumer));
new JsonSerializer
{
NullValueHandling = NullValueHandling.Ignore
}.Serialize(writer, new DependentPackage(package, feed, consumer));
}
#endif
}
Expand Down Expand Up @@ -89,6 +96,10 @@ public DependentPackage(Package p, string feed, PackageConsumer consumer)
public string DependentPackageGroup => this.c.Group ?? string.Empty;
[JsonPropertyName("dependentVersion")]
public string DependentPackageVersion => this.c.Version;
[JsonPropertyName("dependentFeed")]
public string DependentPackageFeed => this.c.Feed;
[JsonPropertyName("dependentUrl")]
public object DependentPackageUrl => this.c.Url;
}
}
}

0 comments on commit 3620609

Please sign in to comment.