From 751e381230762caa6937e9c516de82fd27c59250 Mon Sep 17 00:00:00 2001 From: unwox Date: Fri, 23 Aug 2024 21:14:30 +0600 Subject: pass a single response object instead of multiple arguments to lua --- main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'main.go') 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 } -- cgit v1.2.3