URI Builder Set/Append Query Should Accept Key/Value as Separate Arguments

Nov 26, 2014 at 6:22 PM
Edited Nov 26, 2014 at 6:24 PM
I was slightly annoyed when I found that it only accepted a single string argument. As a result, I still had to do some string concatenation outside with the equals signs.

I would really appreciate if there were overloads that would accept something like this:
builder.set/append_query(U("key1"), U("val1"));
Coordinator
Nov 26, 2014 at 6:54 PM
Hi kotsoft,

This exact API you speak of does exist on the uri_builder class. Take a look at the reference documentation here. You can do exactly what you mention in your post, you also can easily append other values that aren't strings as long as they support the '<<' stream operator.

Steve
Nov 26, 2014 at 7:46 PM
Oops, sorry. I was working with code completion and I guess I just assumed append_query wouldn't have it because set_query didn't.
Coordinator
Dec 2, 2014 at 1:40 PM
Hi kotsoft,

Yes, naming wise set_query will completely clobber any previously set query component. We named this API append_query to make it clear to help make it clear to the user that any existing set query component won't be lost and instead appended to.

Steve