Why does RestSharp allow 'localhost' as a valid host, but not 'http://localhost'?

15 views
Skip to first unread message

Brendan Pert

unread,
Jan 21, 2025, 11:17:20 PMJan 21
to RestSharp
Why does RestSharp allow 'localhost' as a valid host, but not 'http://localhost' or 'https://localhost'?

As seen in this pull request from a while ago showing the Host Validation Test Cases:
https://github.com/restsharp/RestSharp/pull/505/files/83f79a5aeb368451b1db3c4622be6c83959ca67b#diff-c48e8d090328a7563564b12a4ec12ba1835ab06d034b1881a906b641fd185d0c

The Test Cases are setup so  [InlineData("http://localhost")] fails validation while  [InlineData("localhost")] passes validation.

What is the reasoning behind this?
I've looked elsewhere online but haven't been able to find an answer.

Many Thanks,
Brendan
Reply all
Reply to author
Forward
0 new messages