Files
wren/test/web/client_url_parse.wren
T
retoor 74ef5cbc11 feat: add merge_all_wren utility, strutil demo, and 7 new API manual pages
Add WrenFileReader class in apps/merge_all_wren.wren for recursive .wren file discovery and content printing. Introduce example/strutil_demo.wren demonstrating case conversion, hex encoding, SHA256 hashing, string repetition, padding, HTML/JSON escaping, and URL encoding/decoding. Create manual/api pages for argparse, dataset, html, markdown, uuid, wdantic, and web modules. Update manual/api/index.html sidebar and module count from 21 to 28, adding links and cards for the new modules.
2026-01-25 01:47:47 +00:00

28 lines
1.0 KiB
JavaScript
Vendored

// retoor <retoor@molodetz.nl>
import "web" for Client
var parsed1 = Client.parseUrl_("http://example.com/path")
System.print(parsed1["scheme"]) // expect: http
System.print(parsed1["host"]) // expect: example.com
System.print(parsed1["port"]) // expect: 80
System.print(parsed1["path"]) // expect: /path
var parsed2 = Client.parseUrl_("https://example.com/path")
System.print(parsed2["scheme"]) // expect: https
System.print(parsed2["port"]) // expect: 443
var parsed3 = Client.parseUrl_("http://example.com:8080/api/v1")
System.print(parsed3["host"]) // expect: example.com
System.print(parsed3["port"]) // expect: 8080
System.print(parsed3["path"]) // expect: /api/v1
var parsed4 = Client.parseUrl_("https://api.example.com")
System.print(parsed4["host"]) // expect: api.example.com
System.print(parsed4["path"]) // expect: /
var parsed5 = Client.parseUrl_("http://localhost:3000/")
System.print(parsed5["host"]) // expect: localhost
System.print(parsed5["port"]) // expect: 3000
System.print(parsed5["path"]) // expect: /