tmenier / Flurl

Fluent URL builder and testable HTTP client for .NET

Home Page:https://flurl.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A way to preserve host casing?

MihaMarkic opened this issue · comments

Is there a way to preserve letter casing with Flurl's URL parsing? Currently it would always lowercase Host.

Input: var url = Url.Parse("https://SomeThing.com/Path")

Output using url.ToString()

Actual: https://something.com/Path

Expected: https://SomeThing.com/Path

Related stack overflow question.

For Host, the short answer is no. Flurl leverages System.Uri for some aspects of its parsing, and that class normalizes the passed string to its canonical form, which includes lower-casing the scheme and host.

You can re-open this as a feature request if you want. I just wanted to explain how it works today. Admittedly, it was never intentional behavior and Flurl generally has the philosophy of don't mess with the original string. So I would entertain it if there are legitimate use cases.