-
Notifications
You must be signed in to change notification settings - Fork 19
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
change the name of merge
or at least mention differences?
#10
Comments
Note that generic So I'm not quite sure we should change
I think julia> u = URI("http://example.com/foo")
URI("http://example.com/foo")
julia> Base.joinpath(u::URI, path_components::AbstractString...) = merge(u, path=join((u.path, path_components...), '/'))
julia> joinpath(u, "bar")
URI("http://example.com/foo/bar")
julia> joinpath(u, "bar", "baz")
URI("http://example.com/foo/bar/baz")
Yes, I think this should be done and we should deprecate the current |
I think overloading Base.merge(uri::URI, d::Dict) = URI(uri; query=merge(queryparams(uri), d)) I'll make a PR of the rest changes then. |
Very true. My thought was that we'd have to combine the existing query string with the new key value pairs, and that would be making a possibly invalid assumption about the format of that string. But perhaps that's not something to worry about. |
umm, so what about just support this convenient one-liner first and see what happens? |
Yeah I think that'd be ok. For |
Lines 1 to 4 in 97a4f30
|
yes, I think that's what I originally posted this issue for then I submitted a PR. |
I was trying to merge some new query params to existing ones with
merge
, but to my surprise that merge creates a newURI
withpath
,query
etc. instead of merging them with the old ones. This is quite confusing to me before I read the implementation since themerge
onDict
actually "merge" the old one with the new one together. I'm wondering if the name ofmerge
should be changed to something else so it is clearer?On the other hand, I'm wondering if there could be such a method that adds some new properties to the existing query. E.g it's useful when a REST API is provided via a path
https:://auth.ibmq.com/api
which is parsed as"https:://auth.ibmq.com"
and "/api" as its path, then a method that join the path of the REST API calls would be very convenient to produce things like"https:://auth.ibmq.com/api/loginWithAuth"
PS. I think probably let the
URI
constructor take some keywords makes more sense than overloadingmerge
in this case.The text was updated successfully, but these errors were encountered: