-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Uri] Add QueryHelpers type #32606
Comments
CC @MihaZupan |
So, as a strawman, a |
Yes! Though not to forget methods for parsing a query string as well. Icing on the cake would be designing it to be used without needing to allocate a bunch of tiny strings. Aside: |
cc @Tratcher |
I don't know if we would worry too much right now about a proposed Static high-performance APIs on |
Perhaps a |
I don't think we would add explicit array support -- they are to my knowledge not a defined feature of URIs, with some platforms recognizing We would want to design the API so that users could do either, though. |
It depends on the given library, how values are bound to the target type, In libraries where Though my comment was about having multiple values for a key. |
Triage: Sounds reasonable and valuable. It would help us obsolete some of the 'bad' APIs on |
+1, it is very weird that there's no elegant, built-in way to construct query strings for |
Today we have UriBuilder accepting a string through
UriBuilder().Query
however as far as I know there are no tools in the framework to help you build such a string.Now if you do this as a literal it's fairly easy to prove correct but when dynamically building it you have to be mindful that query string keys and values should be properly escaped.
Under the AspNetCore namespace there's QueryHelpers https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.webutilities.queryhelpers?view=aspnetcore-3.1
I would have expected something like this to be built in. It's after all an http-centric world we live in.
EDIT: Hmm apparently System.Web.HttpUtility is actually available on .net core (even though System.Web itself isn't) though it seems to have bugs and isn't really modern.
Related #31147 which was closed as a duplicate of #29736 though I see no mention of query string apis in the latter issue.
It seems to be time to create new modern http url manipulation apis.
To clarify, I wouldn't want to have to reference AspNetCore as a framework reference in libraries.
The text was updated successfully, but these errors were encountered: