Repository navigation
Fix issues found during the connection-reuse review - #38
Merged
Merged
Conversation
System.Text.Json never sets a collection property that has a non-public setter, so Languages has deserialised as an empty list since the move to System.Text.Json. Give it a public setter, as Blocklists already has, and cover it with the existing fixtures. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The threat object of a response carries is_vpn and a scores object (vpn_score, proxy_score, threat_score and trust_score), which the model dropped. Add IsVpn (bool?) and Scores (a new ThreatScores class with int? members) so both are read; null means the response did not include the value. Document the fields in the README and the sample. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Requests carried no User-Agent, so the API could not tell which client library made them, and no Accept header. CreateRequest now adds "User-Agent: ipdata-dotnet/<version>" and "Accept: application/json" on both target frameworks. The version is the package version read from the assembly's informational version at run time (without the "+commit" build metadata), so no new dependency is needed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Formatter-based serialization is obsolete on .NET 8 and later, and the protected (SerializationInfo, StreamingContext) constructors of ApiException and its subclasses produced SYSLIB0051 warnings in the net8.0 build. The constructors stay on every target so the public shape of the types does not change; on net8.0 they are marked obsolete with the same SYSLIB0051 diagnostic id, which silences the warning in the library and passes it on to any code that still calls them. The netstandard2.0 build is unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
PackageIconUrl is deprecated (NU5048) and pointed at an externally hosted image. The package now embeds icon.png, a PNG export of the 64x64 frame of the project's icon, through PackageIcon. ApplicationIcon and the empty Win32Resource only apply to executables, so they are removed from the class library together with the .ico file they used. IPData.nuspec was never used by dotnet pack (the SDK-style project generates its own manifest) and had drifted from the project file, so it is removed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
IPData.sln listed .github/CODE_OF_CONDUCT.md and .github/PULL_REQUEST_TEMPLATE.md as solution items, but neither file exists in the repository. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Move the test project to current releases: xunit 2.9.3 with xunit.runner.visualstudio 4.0.1 and Microsoft.NET.Test.Sdk 18.11.0, FluentAssertions 7.2.2 (the last line under the Apache-2.0 license) with FluentAssertions.Analyzers 0.33.0 (the newest release built against a Roslyn version that every .NET 8 SDK ships; 0.34 needs Roslyn 4.11), coverlet.msbuild 10.1.0, AutoFixture 4.18.1 and an explicit Moq 4.20.72 reference, which replaces the Moq 4.7.0 that AutoFixture.AutoMoq pulled in. The xunit analyzers flag ConfigureAwait(false) in test methods (xUnit1030) because it can bypass the runner's parallelization limits, so those calls are removed from the tests. All 137 tests pass on the new stack. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #37: fixes the items that pull request listed under "Noticed, not changed". No public symbol is renamed or removed and the version stays 3.1.0; the public-API additions are one setter, two model properties with a new
ThreatScoresclass, and two request headers. The Release build is now warning-free.Changes
IPLookupResult.Languagesis populated again. System.Text.Json does not set a collection property that has a non-public setter, soLanguagesalways deserialised as an empty list. The setter is now public (asBlocklistsalready is), with tests from the fixtures.Threat.IsVpnandThreat.Scores.is_vpnmaps toIsVpn(bool?) andscoresto a newThreatScoresclass (VpnScore,ProxyScore,ThreatScore,TrustScore, allint?);nullmeans the response did not include the value. Documented in the README and the sample. Tests cover the VPN, satellite, anycast and bulk fixtures, a partialscoresobject, aGET /{ip}/threatbody and a serialize/deserialize round trip.User-AgentandAcceptheaders. Every request now carriesUser-Agent: ipdata-dotnet/<version>andAccept: application/jsonon both target frameworks. The version is the package version read from the assembly's informational version at run time (build metadata stripped, assembly version as fallback), so no dependency was added. Tests assert both headers through the mockedIHttpClientand through a realHttpClient.(SerializationInfo, StreamingContext)constructors ofApiExceptionand its subclasses stay on every target; on net8.0 they are marked[Obsolete(DiagnosticId = "SYSLIB0051")], so the library builds without the warning and code that still calls them gets the runtime's own diagnostic. The netstandard2.0 build is unchanged. A test checks that each constructor is still present, protected and marked.PackageIconUrl(deprecated, NU5048, an externally hosted image) is replaced byPackageIconwithicon.pngembedded in the package, a PNG export of the 64x64 frame of the former.ico.ApplicationIconand the emptyWin32Resource, which only apply to executables, are removed together with the.ico; the assemblies no longer carry a 34 KB Win32 icon resource.IPData.nuspecremoved.dotnet packnever used it (SDK-style project generates its own manifest) and its authors and dependency groups had drifted from the project file. The generated manifest is unchanged apart from the icon element.IPData.slnno longer lists.github/CODE_OF_CONDUCT.mdand.github/PULL_REQUEST_TEMPLATE.md, which do not exist.ConfigureAwait(false)in test methods (xUnit1030, it can bypass the runner's parallelization limits), so those calls were removed from the tests; nothing else in the tests changed and all of them pass on the new stack.Not changed
.editorconfigasks for CRLF in*.cs, but 23 of the 38.csfiles are LF. Normalising in either direction rewrites every line of one set of files, so this PR keeps each file's existing endings and leaves the normalisation to a dedicated commit (ideally with a.gitattributes).System.Text.Json4.7.2 (netstandard2.0 asset only). Not flagged by NuGet audit; bumping it would change the dependency surface for .NET Standard consumers, which is a separate decision.System.ComponentModel.TypeConverter4.3.0 in the test project is already the latest release of that package.Verification
All commands run from the repository root with .NET SDK 8.0.133 on Linux, before the push:
A console app referencing the project and sending through a real
HttpClientwith a recording handler shows the request asGET https://api.ipdata.co/8.8.8.8?api-key=<key> HTTP/2.0 (RequestVersionOrLower)withUser-Agent: ipdata-dotnet/3.1.0andAccept: application/json, and deserialiseslanguages,is_vpnandscoresfrom the recorded body. The same call against the live endpoint with a placeholder key returnsUnauthorizedException(HTTP 401), so the server accepts the headers.Not verified: the netstandard2.0 asset compiles and packs but has no runnable test target, so its header and constructor code paths are build-verified only.
CI: the
CIworkflow, run #18 on 02a852e (pull_request, jobbuild-and-test): success. Restore, Build, Test and Pack all passed.🤖 Generated with Claude Code