ae
ae copied to clipboard
Query string
It seems this package can parse a URL, but cannot parse a query string into a map, or vice versa. Is that correct?
Are you looking for decodeUrlParameters and encodeUrlParameters?
Yes this seems to work as expected, thank you!
import ae = ae.net.ietf.url;
import io = std.stdio;
void main() {
// example 1
auto s = "month=March&day=Friday";
auto m1 = ae.decodeUrlParameters(s);
// example 2
auto m = ["month": "March", "day": "Friday"];
auto s2 = ae.encodeUrlParameters(m);
// print
io.writeln(m1, s2);
}
Also, does this project really have no documentation?
Also is a general URL parser available? I only found this:
https://github.com/CyberShadow/ae/blob/904d5b6ab7a15b3ecac499ef41bb40a88fd64e1e/net/http/common.d#L58-L63
Also, does this project really have no documentation?
I haven't been thorough in writing DDoc for definitions in the library's early days (as it's not something that's useful for me personally even in other projects, I use go-to-definition in the editor and read the code). Newer symbols should be more consistently documented.
In terms of separate documentation pages, there is https://ae.dpldocs.info/ (generated automatically).
Also is a general URL parser available? I only found this:
That's the one. Perhaps I hadn't fully thought that through when I wrote it ten years ago.