Skip to content

refactor(sync): pass Uri to HttpClient instead of path strings (CA2234) - #163

Merged
DeepDiver1975 merged 1 commit into
mainfrom
fix/analyzer-uri-http
Aug 30, 2026
Merged

refactor(sync): pass Uri to HttpClient instead of path strings (CA2234)#163
DeepDiver1975 merged 1 commit into
mainfrom
fix/analyzer-uri-http

Conversation

@DeepDiver1975

Copy link
Copy Markdown
Collaborator

CA2234 flags passing a string to HttpClient.GetAsync/GetStringAsync/PostAsync when the relative string is only ever turned into a Uri — the string overloads accept and strip query strings, conflate base-address handling, and re-parse on every call.

All 20 sites (40 warnings) fixed by passing new Uri(path, UriKind.RelativeOrAbsolute) — byte-for-byte what HttpClient's string overload does internally, so behavior is unchanged and the analyzer is satisfied:

  • src: 5 sites in RemoteIncidentSession (version handshake, snapshot, file download, command post, resync).
  • tests: 15 sites in IncidentHostTests (the auth-gate and snapshot assertions).

Verification: CA2234 at 0 under AnalysisMode=All, zero errors, no change to any other rule; full suite 801 passed / 1 skipped.

Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
@DeepDiver1975
DeepDiver1975 merged commit af958c3 into main Aug 30, 2026
2 checks passed
@DeepDiver1975
DeepDiver1975 deleted the fix/analyzer-uri-http branch August 30, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant