I wanted to take an existing url and modify the query parameters. I noticed Url is just a record type so I figured the correct way to do this is
{ currentUrl
| query =
Url.Builder.toQuery [ Url.Builder.string "data" "test" ] |> Just
}
|> Url.toString
but when I did that the result was http://localhost:3000/??data=test instead of http://localhost:3000/?data=test.
This seems to be a bug or at least unintuitive behavior and what I ended up doing to make it work was add String.dropLeft 1 to the toQuery output.
I wanted to take an existing url and modify the query parameters. I noticed
Urlis just a record type so I figured the correct way to do this isbut when I did that the result was
http://localhost:3000/??data=testinstead ofhttp://localhost:3000/?data=test.This seems to be a bug or at least unintuitive behavior and what I ended up doing to make it work was add
String.dropLeft 1to thetoQueryoutput.