From 0efda4d37f7d22f6754071666d64e7d7820d94a1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 26 Feb 2026 11:28:00 +0000 Subject: [PATCH 1/2] Make Http.AppendQueryToUrl public (closes #1325) Remove `internal` modifier from `Http.AppendQueryToUrl` so callers can use it directly to build query strings without duplicating the escaping logic. Five unit tests added. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- RELEASE_NOTES.md | 1 + src/FSharp.Data.Http/Http.fs | 2 +- tests/FSharp.Data.Core.Tests/Http.fs | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index b69a921b9..6cf1b220e 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -2,6 +2,7 @@ ## 8.1.0-beta +- Make `Http.AppendQueryToUrl` public (closes #1325) - Add `PreferOptionals` parameter to `JsonProvider` and `XmlProvider` (defaults to `true` to match existing behavior; set to `false` to use empty string or `NaN` for missing values, like the CsvProvider default) (closes #649) ## 8.0.0 - Feb 25 2026 diff --git a/src/FSharp.Data.Http/Http.fs b/src/FSharp.Data.Http/Http.fs index e394ad507..937145bfc 100644 --- a/src/FSharp.Data.Http/Http.fs +++ b/src/FSharp.Data.Http/Http.fs @@ -2004,7 +2004,7 @@ type Http private () = (WebUtility.UrlEncode query).Replace("+", "%20") /// Appends the query parameters to the url, taking care of proper escaping - static member internal AppendQueryToUrl(url: string, query) = + static member AppendQueryToUrl(url: string, query) = match query with | [] -> url | query -> diff --git a/tests/FSharp.Data.Core.Tests/Http.fs b/tests/FSharp.Data.Core.Tests/Http.fs index dc41d1dce..118d6eb1e 100644 --- a/tests/FSharp.Data.Core.Tests/Http.fs +++ b/tests/FSharp.Data.Core.Tests/Http.fs @@ -69,6 +69,30 @@ let startHttpLocalServer() = member this.WorkerTask = workerTask member this.BaseAddress = baseAddress } +[] +let ``AppendQueryToUrl with no query returns url unchanged`` () = + Http.AppendQueryToUrl("https://example.com/api", []) |> should equal "https://example.com/api" + +[] +let ``AppendQueryToUrl appends query parameters`` () = + Http.AppendQueryToUrl("https://example.com/api", [ "key", "value" ]) + |> should equal "https://example.com/api?key=value" + +[] +let ``AppendQueryToUrl appends multiple query parameters`` () = + Http.AppendQueryToUrl("https://example.com/api", [ "a", "1"; "b", "2" ]) + |> should equal "https://example.com/api?a=1&b=2" + +[] +let ``AppendQueryToUrl uses ampersand when url already contains query`` () = + Http.AppendQueryToUrl("https://example.com/api?existing=x", [ "key", "value" ]) + |> should equal "https://example.com/api?existing=x&key=value" + +[] +let ``AppendQueryToUrl percent-encodes special characters in keys and values`` () = + Http.AppendQueryToUrl("https://example.com/search", [ "q", "hello world" ]) + |> should equal "https://example.com/search?q=hello%20world" + [] let ``Don't throw exceptions on http error`` () = use localServer = startHttpLocalServer() From f34b37b608dd1112ca9763db021ea31dabcd0ace Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 26 Feb 2026 11:30:59 +0000 Subject: [PATCH 2/2] ci: trigger CI checks