aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authoramy <[email protected]>2024-01-30 11:56:55 -0600
committeramy <[email protected]>2024-01-30 11:56:55 -0600
commitba70b8aef78bf2de4aff47a1732027388c62f9fd (patch)
treea613687fb83e5559eb70ffbbb014a6537e7a2882 /docs
parent2b6695d4e343915f5a8200409ef1e39ab55bfb13 (diff)
wrong place whoops
Diffstat (limited to 'docs')
-rw-r--r--docs/net.md28
1 files changed, 21 insertions, 7 deletions
diff --git a/docs/net.md b/docs/net.md
index 11ae80f..192048e 100644
--- a/docs/net.md
+++ b/docs/net.md
@@ -32,7 +32,7 @@ closes server
'takes a function with 3 paramaters
-first and second are res and req as described in server:GET, the third is a function to move to the next point
+first and second are res and req as described in server:GET, the third is a function to move to the next point, executes in the order given and can be chained
```lua
server:use(function(res, req, next)
@@ -75,7 +75,7 @@ res:send("<h1>hello world</h1>")
#### res:set **
-'takes 2 strings, key and value
+'takes an even number of strings, key and value pairs
set the key to value in the response header, certain keys will affect other values or have other side effects on res:send, listed below
@@ -83,17 +83,31 @@ set the key to value in the response header, certain keys will affect other valu
|--|--|
|Code|Changes response note, ie: (200: OK)|
+#### res:close **
+
+closes connection
+
+#### res.header
+
+table containing all head information, anything added to it will be used, certain keys will affect other values or have other side effects on res:send, listed below
+
+|key|side effect|
+|--|--|
+|Code|Changes response note, ie: (200: OK)|
```lua
...
-res:set("Content-Type", "text/html") -- Content-Type: text/html
+res.header["Code"] = 404
+res.header["test"] = "wowa"
+-- new header will have a code of 404 (at the top duh)
+-- and a new field "test"
+--
+-- HTTP/1.1 404 Not Found
+-- ...
+-- test: wowa
...
```
-#### res:close **
-
-closes connection
-
### server:static_serve **
'takes two strings, first is server serve path, second is local path, being a file or directory