-
Notifications
You must be signed in to change notification settings - Fork 193
Confusing UriHelper method names #573
Comments
Putting in 1.0.0 to consider this post RC2. |
I don't entirely agree with the proposed but I 100% agree that the existing methods are completely confusing and lead users down a pit of failure. Hence spawning my other issue here. We should consider fixing/designing this for RTM seeing how confusing the APIs currently are. |
@NTaylorMullen @Tratcher Do you guys have a set of proposed names? cc @Eilon |
One proposal from offline discussion: |
👍 for |
FYI: I only see one usage of this API in our code base, and that's in a sample: |
To answer some of @strohhut original questions: UriHelper helps you assemble urls from parts for links or redirects. These scenarios always require encoding. These parts are usually a mixture items from the current request and new items for the next operation. E.g. You'd usually keep the original Host and PathBase, but may change the scheme, query, etc.. |
Thanks, it helped me to understand the purpose of the methods. |
Sorry, I find this helper class a bit confusing.
Why is a method that does more than encoding called
Encode
? It not only encodes it also combines several uri parts into an uri. And why are two methods calledEncode
when one creates an absolute path and the other creates an absolute uri? Why is the unescaped version called so differently (GetDisplayUrl
)? Why is the convenience methodGetEncodedUrl
named this way although it does exactly the same as theEncode
method? Only difference is that it is an extension method forHttpRequest
. Why is there no convenience method for the non-absolute version?Maybe I just don't get it but here is my proposal:
Why not just have two method names
GetAbsolutePath
andGetUrl
? Then give those two methods anencode
orhttpEncode
orencodeComponents
bool parameter so there is no need for anyDisplay
methods. Then make overloads of both methods that act as convenience methods forHttpRequest
.So we would get
gives
/foo/bar
Note that this would conform to RFC 3986
gives
http://example.com/foo/bar
The text was updated successfully, but these errors were encountered: