Closed mfarid2 closed 6 months ago
I'm not sure this is a bug. I think your problem is you're double encoding; you're url encoding your values, and then Flurl is doing it for you again. Check out this documentation
Try this instead:
var url = "https://test.com"
.AppendPathSegment("folder1/folder2")
.SetQueryParams(new
{
date_start = $"{today}@date",
date_end = $"{today}@date"
});
OR, if you don't like how Flurl encodes it and you want to do it manually, try this:
var url = "https://test.com"
.AppendPathSegment("folder1/folder2")
.SetQueryParam("date_start", WebUtility.UrlEncode($"{today}@date"),true)
.SetQueryParam("date_start", WebUtility.UrlEncode($"{today}@date"),true);
@SemaphoreSlim1 Yes. You are right. Double encoding happened. But it happens without WebUtility.UrlEncode() too. I did took your approach with some change.
var url = "https://test.com"
.AppendPathSegment("folder1/folder2")
.SetQueryParam("date_start", today + "%40date", true)
.SetQueryParam("date_end", today + "%40date", true);
Many thanks.
Flurl.Http 4.0.2
Expected result:
Result: