summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorunwox <me@unwox.com>2024-08-23 21:14:30 +0600
committerunwox <me@unwox.com>2024-08-23 21:14:30 +0600
commit751e381230762caa6937e9c516de82fd27c59250 (patch)
tree10a4ded95e673133d9e8303524a585469e805786 /main.go
parent4003417f7b94648a7726995a49ab56c4bc8aad55 (diff)
pass a single response object instead of multiple arguments to lua
Diffstat (limited to 'main.go')
-rw-r--r--main.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/main.go b/main.go
index 92ccb2f..26a7798 100644
--- a/main.go
+++ b/main.go
@@ -27,6 +27,7 @@ func main() {
routeModule["route"] = func (l *Lua) int {
fn := l.PopToRef()
route := l.ToString(-1)
+ l.Pop(1)
// find corresponding worker for the lua context
var wrk *Worker
for _, wrk = range wrks {
@@ -111,13 +112,13 @@ func main() {
// fixme: return error
return 0
}
- respHeaders := make(map[string]string)
+ respHeaders := make(map[string]any)
for k := range resp.Header {
respHeaders[k] = resp.Header.Get(k)
}
l.PushNumber(resp.StatusCode)
- l.PushStringTable(respHeaders)
+ l.PushObject(respHeaders)
l.PushString(string(respBody))
return 3
}