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.
This commit is contained in:
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "web" for Response
|
||||
|
||||
var r1 = Response.redirect("/dashboard", 301)
|
||||
System.print(r1.status) // expect: 301
|
||||
System.print(r1.headers["Location"]) // expect: /dashboard
|
||||
|
||||
var r2 = Response.new()
|
||||
r2.status = 404
|
||||
r2.body = "Not Found"
|
||||
System.print(r2.status) // expect: 404
|
||||
System.print(r2.body) // expect: Not Found
|
||||
|
||||
var r3 = Response.new()
|
||||
r3.header("X-Custom", "value1")
|
||||
r3.header("X-Another", "value2")
|
||||
System.print(r3.headers["X-Custom"]) // expect: value1
|
||||
System.print(r3.headers["X-Another"]) // expect: value2
|
||||
|
||||
var r4 = Response.new()
|
||||
r4.cookie("session", "abc123")
|
||||
r4.body = "test"
|
||||
var built = r4.build()
|
||||
System.print(built.contains("Set-Cookie: session=abc123")) // expect: true
|
||||
|
||||
var r5 = Response.new()
|
||||
r5.cookie("auth", "token", {"path": "/", "httpOnly": true, "maxAge": 3600})
|
||||
r5.body = "test"
|
||||
var built2 = r5.build()
|
||||
System.print(built2.contains("Path=/")) // expect: true
|
||||
System.print(built2.contains("HttpOnly")) // expect: true
|
||||
System.print(built2.contains("Max-Age=3600")) // expect: true
|
||||
|
||||
var r6 = Response.text("Hello World")
|
||||
var httpResponse = r6.build()
|
||||
System.print(httpResponse.contains("HTTP/1.1 200 OK")) // expect: true
|
||||
System.print(httpResponse.contains("Content-Length:")) // expect: true
|
||||
System.print(httpResponse.contains("Hello World")) // expect: true
|
||||
Reference in New Issue
Block a user