summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2025-09-04 19:51:57 +0600
committerunwox <me@unwox.com>2025-09-04 19:51:57 +0600
commit422f390b37fa9b325b3605dda2a064a23dbec5ba (patch)
tree1b3b5e1a7732a8de072c04c4cb56eb15c723b653 /main.go
parent4fb1e3313bd41d2c6a0a1934a74304ebe6c702e9 (diff)
add luna.http.decode-url api method
Diffstat (limited to 'main.go')
-rw-r--r--main.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/main.go b/main.go
index 96f0a18..7f32504 100644
--- a/main.go
+++ b/main.go
@@ -178,6 +178,19 @@ func main() {
return luaOk(l, url.QueryEscape(str))
}
httpModule["encodeURL"] = httpModule["encode-url"]
+ httpModule["decode-url"] = func (l *Lua) int {
+ var str string
+ err := l.Scan(&str)
+ if err != nil {
+ return luaErr(l, err)
+ }
+ res, err := url.QueryUnescape(str)
+ if err != nil {
+ return luaErr(l, err)
+ }
+ return luaOk(l, res)
+ }
+ httpModule["decodeURL"] = httpModule["decode-url"]
// define luna.db module
dbModule := make(map[string]any)