ae icon indicating copy to clipboard operation
ae copied to clipboard

Query string

Open 89z opened this issue 4 years ago • 4 comments

It seems this package can parse a URL, but cannot parse a query string into a map, or vice versa. Is that correct?

89z avatar Jan 30 '21 21:01 89z

Are you looking for decodeUrlParameters and encodeUrlParameters?

CyberShadow avatar Jan 31 '21 01:01 CyberShadow

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?

89z avatar Jan 31 '21 15:01 89z

Also is a general URL parser available? I only found this:

https://github.com/CyberShadow/ae/blob/904d5b6ab7a15b3ecac499ef41bb40a88fd64e1e/net/http/common.d#L58-L63

89z avatar Feb 01 '21 00:02 89z

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.

CyberShadow avatar Feb 01 '21 03:02 CyberShadow