Lua script context API - HTTP sub-context
HTTP request and response data (for HTTP protocol).
| Field | Type | Access | Description |
|---|
method | string? | read | HTTP method (GET, POST, etc.) |
path | string? | read/write | Request path |
query | table? | read | Query parameters |
headers | table? | read | Request headers |
body | value? | read/write | Request body |
response | value? | read/write | Response body |
addr | string? | read | Client address |
status | string? | read/write | Response status code |
json | boolean? | read/write | Use JSON response format |
client | client? | read | HTTP client info |
server | server? | read | HTTP server info |
| Method | Parameters | Returns | Description |
|---|
get_query(key) | parameter name | value? | Get query parameter |
get_header(key) | header name | value? | Get request header |
get_response_header(key) | header name | value? | Get response header |
set_response_header(key, value) | header name, value | - | Set response header |
| Field | Type | Description |
|---|
name | string | Client name |
ip | string? | Client IP address |
| Field | Type | Description |
|---|
name | string | Server name |
ip | string | Server IP address |
port | number | Server port |
tls | boolean | Is TLS enabled? |