Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/FSharp.Data.Http/Http.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
24 changes: 24 additions & 0 deletions tests/FSharp.Data.Core.Tests/Http.fs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,30 @@ let startHttpLocalServer() =
member this.WorkerTask = workerTask
member this.BaseAddress = baseAddress }

[<Test>]
let ``AppendQueryToUrl with no query returns url unchanged`` () =
Http.AppendQueryToUrl("https://example.com/api", []) |> should equal "https://example.com/api"

[<Test>]
let ``AppendQueryToUrl appends query parameters`` () =
Http.AppendQueryToUrl("https://example.com/api", [ "key", "value" ])
|> should equal "https://example.com/api?key=value"

[<Test>]
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"

[<Test>]
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"

[<Test>]
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"

[<Test>]
let ``Don't throw exceptions on http error`` () =
use localServer = startHttpLocalServer()
Expand Down
Loading