{
  "classes": [
    {
      "constants": [],
      "types": [],
      "name": "@eryx/http/ServerResponse",
      "tags": [],
      "functions": [],
      "properties": [],
      "source": {
        "path": "",
        "line": 0
      },
      "desc": "A writable HTTP response used inside an [[HttpServer]] handler.\n\nSupports both one-shot replies and streaming (chunked transfer-encoding).\nTrailers can also be attached to chunked responses.\n\n**One-shot:**\n```luau\nres:send(200, \"Hello!\")\n```\n\n**Streaming:**\n```luau\nres:status(200):header(\"content-type\", \"text/plain\")\nres:write(\"chunk 1\")\nres:write(\"chunk 2\")\nres:finish()\n```\n\n**Stream from a reader:**\n```luau\nres:status(200)\nres:trailer(\"x-checksum\", \"ok\")\nres:sendStream(myReader)\n```\n"
    },
    {
      "is_primary_export": false,
      "source": {
        "path": "",
        "line": 74
      },
      "tags": [],
      "properties": [
        {
          "tags": [],
          "lua_type": "close: (((self: ResponseBodyStream) → ()))?",
          "name": "close",
          "desc": ""
        }
      ],
      "desc": "",
      "name": "ResponseBodyStream",
      "functions": [
        {
          "source": {
            "path": "",
            "line": 75
          },
          "is_method": true,
          "signature": "ResponseBodyStream:read(size: number?) → string?",
          "desc": "",
          "tags": [],
          "name": "read",
          "return_str": "string?",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "string?",
              "desc": ""
            }
          ],
          "params": [
            {
              "lua_type": "number?",
              "name": "size",
              "desc": ""
            }
          ]
        }
      ],
      "metamethods": [],
      "types": []
    },
    {
      "is_primary_export": false,
      "source": {
        "path": "",
        "line": 95
      },
      "tags": [],
      "properties": [
        {
          "tags": [],
          "lua_type": "_sock: any",
          "name": "_sock",
          "desc": ""
        },
        {
          "tags": [],
          "lua_type": "_headersSent: boolean",
          "name": "_headersSent",
          "desc": ""
        },
        {
          "tags": [],
          "lua_type": "_finished: boolean",
          "name": "_finished",
          "desc": ""
        },
        {
          "tags": [],
          "lua_type": "_upgraded: boolean",
          "name": "_upgraded",
          "desc": ""
        },
        {
          "tags": [],
          "lua_type": "_status: number",
          "name": "_status",
          "desc": ""
        },
        {
          "tags": [],
          "lua_type": "_reason: string",
          "name": "_reason",
          "desc": ""
        },
        {
          "tags": [],
          "lua_type": "_headers: { [string]: string }",
          "name": "_headers",
          "desc": ""
        },
        {
          "tags": [],
          "lua_type": "_chunked: boolean",
          "name": "_chunked",
          "desc": ""
        },
        {
          "tags": [],
          "lua_type": "_requestMethod: string?",
          "name": "_requestMethod",
          "desc": ""
        },
        {
          "tags": [],
          "lua_type": "_requestHttpVersion: string?",
          "name": "_requestHttpVersion",
          "desc": ""
        },
        {
          "tags": [],
          "lua_type": "_keepAlive: boolean",
          "name": "_keepAlive",
          "desc": ""
        },
        {
          "tags": [],
          "lua_type": "_holdOpen: boolean",
          "name": "_holdOpen",
          "desc": ""
        },
        {
          "tags": [],
          "lua_type": "_trailers: { [string]: string }",
          "name": "_trailers",
          "desc": ""
        }
      ],
      "desc": "",
      "name": "ServerResponse",
      "functions": [
        {
          "source": {
            "path": "",
            "line": 112
          },
          "is_method": false,
          "signature": "ServerResponse._new(sock: any, requestMethod: string?, requestHttpVersion: string?, requestHeaders: { [string]: string }?) → ServerResponse",
          "owner": "ServerResponse",
          "desc": "",
          "tags": [],
          "name": "_new",
          "return_str": "ServerResponse",
          "function_type": "Function",
          "returns": [
            {
              "lua_type": "ServerResponse",
              "desc": ""
            }
          ],
          "params": [
            {
              "lua_type": "any",
              "name": "sock",
              "desc": ""
            },
            {
              "lua_type": "string?",
              "name": "requestMethod",
              "desc": ""
            },
            {
              "lua_type": "string?",
              "name": "requestHttpVersion",
              "desc": ""
            },
            {
              "lua_type": "{ [string]: string }?",
              "name": "requestHeaders",
              "desc": ""
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 135
          },
          "is_method": true,
          "signature": "ServerResponse:holdOpen() → ServerResponse",
          "owner": "ServerResponse",
          "desc": "",
          "tags": [],
          "name": "holdOpen",
          "return_str": "ServerResponse",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ServerResponse",
              "desc": ""
            }
          ],
          "params": []
        },
        {
          "source": {
            "path": "",
            "line": 150
          },
          "is_method": true,
          "signature": "ServerResponse:status(\n    code: number,  -- The HTTP status code (e.g. `200`, `404`).\n    reason: string?  -- Custom reason phrase. Defaults to the standard phrase for the code.\n) → (\n    ServerResponse  -- Self, for method chaining. \n)",
          "owner": "ServerResponse",
          "desc": "Sets the HTTP status code and optional reason phrase.\n\nMust be called before [[ServerResponse.write]] or [[ServerResponse.finish]].\nReturns `self` for chaining.\n",
          "tags": [],
          "name": "status",
          "return_str": "ServerResponse",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ServerResponse",
              "desc": "Self, for method chaining. "
            }
          ],
          "params": [
            {
              "lua_type": "number",
              "name": "code",
              "desc": "The HTTP status code (e.g. `200`, `404`)."
            },
            {
              "lua_type": "string?",
              "name": "reason",
              "desc": "Custom reason phrase. Defaults to the standard phrase for the code."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 167
          },
          "is_method": true,
          "signature": "ServerResponse:header(\n    name: string,  -- The header name (case-insensitive).\n    value: string  -- The header value.\n) → (\n    ServerResponse  -- Self, for method chaining. \n)",
          "owner": "ServerResponse",
          "desc": "Sets a single response header.\n\nMust be called before [[ServerResponse.write]] or [[ServerResponse.finish]].\nReturns `self` for chaining.\n",
          "tags": [],
          "name": "header",
          "return_str": "ServerResponse",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ServerResponse",
              "desc": "Self, for method chaining. "
            }
          ],
          "params": [
            {
              "lua_type": "string",
              "name": "name",
              "desc": "The header name (case-insensitive)."
            },
            {
              "lua_type": "string",
              "name": "value",
              "desc": "The header value."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 182
          },
          "is_method": true,
          "signature": "ServerResponse:headers(\n    hdrs: { [string]: string }  -- A table of header name/value pairs.\n) → (\n    ServerResponse  -- Self, for method chaining. \n)",
          "owner": "ServerResponse",
          "desc": "Sets multiple response headers at once.\n\nMust be called before [[ServerResponse.write]] or [[ServerResponse.finish]].\nReturns `self` for chaining.\n",
          "tags": [],
          "name": "headers",
          "return_str": "ServerResponse",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ServerResponse",
              "desc": "Self, for method chaining. "
            }
          ],
          "params": [
            {
              "lua_type": "{ [string]: string }",
              "name": "hdrs",
              "desc": "A table of header name/value pairs."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 201
          },
          "is_method": true,
          "signature": "ServerResponse:trailer(\n    name: string,  -- The trailer header name.\n    value: string  -- The trailer value.\n) → (\n    ServerResponse  -- Self, for method chaining. \n)",
          "owner": "ServerResponse",
          "desc": "Queues a trailer header to be sent after a chunked response body.\n\nTrailers are only sent for chunked, body-bearing responses. The\nresponse automatically advertises the trailer names in the `Trailer`\nheader.\n",
          "tags": [],
          "name": "trailer",
          "return_str": "ServerResponse",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ServerResponse",
              "desc": "Self, for method chaining. "
            }
          ],
          "params": [
            {
              "lua_type": "string",
              "name": "name",
              "desc": "The trailer header name."
            },
            {
              "lua_type": "string",
              "name": "value",
              "desc": "The trailer value."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 214
          },
          "is_method": true,
          "signature": "ServerResponse:trailers(\n    hdrs: { [string]: string }  -- Trailer name/value pairs.\n) → (\n    ServerResponse  -- Self, for method chaining. \n)",
          "owner": "ServerResponse",
          "desc": "Queues multiple trailer headers to be sent after a chunked response.\n",
          "tags": [],
          "name": "trailers",
          "return_str": "ServerResponse",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ServerResponse",
              "desc": "Self, for method chaining. "
            }
          ],
          "params": [
            {
              "lua_type": "{ [string]: string }",
              "name": "hdrs",
              "desc": "Trailer name/value pairs."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 224
          },
          "is_method": true,
          "signature": "ServerResponse:_sendHead() → ()",
          "owner": "ServerResponse",
          "desc": "flush the status line + headers to the socket.",
          "tags": [
            "Private"
          ],
          "name": "_sendHead",
          "return_str": "",
          "function_type": "Method",
          "returns": [],
          "params": []
        },
        {
          "source": {
            "path": "",
            "line": 302
          },
          "is_method": true,
          "signature": "ServerResponse:write(\n    data: string  -- The body chunk to send.\n) → (\n    ServerResponse  -- Self, for method chaining. \n)",
          "owner": "ServerResponse",
          "desc": "Writes a chunk of the response body.\n\nSends headers on the first call. Can be called multiple times for\nstreaming or long-polling. Uses chunked transfer-encoding when\nno `Content-Length` is set.\n",
          "tags": [],
          "name": "write",
          "return_str": "ServerResponse",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ServerResponse",
              "desc": "Self, for method chaining. "
            }
          ],
          "params": [
            {
              "lua_type": "string",
              "name": "data",
              "desc": "The body chunk to send."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 329
          },
          "is_method": true,
          "signature": "ServerResponse:finish(\n    body: string?  -- Optional final body to send before finishing. \n) → ()",
          "owner": "ServerResponse",
          "desc": "Finishes the response.\n\nSends the terminating chunk if chunked transfer-encoding is active.\nIf `body` is provided, it is a shorthand for\n`write(body)` followed by `finish()`.\n",
          "tags": [],
          "name": "finish",
          "return_str": "",
          "function_type": "Method",
          "returns": [],
          "params": [
            {
              "lua_type": "string?",
              "name": "body",
              "desc": "Optional final body to send before finishing. "
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 372
          },
          "is_method": true,
          "signature": "ServerResponse:sendStream(\n    bodyStream: ResponseBodyStream,  -- The incremental body source.\n    contentLength: number?  -- Optional exact body size in bytes.\n) → (\n    ServerResponse  -- Self, for method chaining. \n)",
          "owner": "ServerResponse",
          "desc": "Streams a response body from an incremental reader.\n\nThis is useful for large downloads, generated content, or proxy-style\nhandlers where buffering the entire body first would be wasteful.\n\nIf `contentLength` is omitted, the response uses chunked transfer\nencoding automatically.\n",
          "tags": [],
          "name": "sendStream",
          "return_str": "ServerResponse",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "ServerResponse",
              "desc": "Self, for method chaining. "
            }
          ],
          "params": [
            {
              "lua_type": "ResponseBodyStream",
              "name": "bodyStream",
              "desc": "The incremental body source."
            },
            {
              "lua_type": "number?",
              "name": "contentLength",
              "desc": "Optional exact body size in bytes."
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 417
          },
          "is_method": true,
          "signature": "ServerResponse:send(\n    statusCode: number,  -- The HTTP status code.\n    body: string?,  -- The response body string.\n    hdrs: { [string]: string }?  -- Optional response headers. \n) → ()",
          "owner": "ServerResponse",
          "desc": "Sends a complete response in one call (status + headers + body).\n\nConvenience for the common case of a simple, non-streaming reply.\n",
          "tags": [],
          "name": "send",
          "return_str": "",
          "function_type": "Method",
          "returns": [],
          "params": [
            {
              "lua_type": "number",
              "name": "statusCode",
              "desc": "The HTTP status code."
            },
            {
              "lua_type": "string?",
              "name": "body",
              "desc": "The response body string."
            },
            {
              "lua_type": "{ [string]: string }?",
              "name": "hdrs",
              "desc": "Optional response headers. "
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 432
          },
          "is_method": true,
          "signature": "ServerResponse:json(\n    statusCode: number,  -- The HTTP status code.\n    data: string  -- The JSON string to send as the body. \n) → ()",
          "owner": "ServerResponse",
          "desc": "Sends a JSON response with the `content-type` header set to\n`application/json`.\n",
          "tags": [],
          "name": "json",
          "return_str": "",
          "function_type": "Method",
          "returns": [],
          "params": [
            {
              "lua_type": "number",
              "name": "statusCode",
              "desc": "The HTTP status code."
            },
            {
              "lua_type": "string",
              "name": "data",
              "desc": "The JSON string to send as the body. "
            }
          ]
        },
        {
          "source": {
            "path": "",
            "line": 438
          },
          "is_method": true,
          "signature": "ServerResponse:wantsKeepAlive() → boolean",
          "owner": "ServerResponse",
          "desc": "",
          "tags": [],
          "name": "wantsKeepAlive",
          "return_str": "boolean",
          "function_type": "Method",
          "returns": [
            {
              "lua_type": "boolean",
              "desc": ""
            }
          ],
          "params": []
        }
      ],
      "metamethods": [],
      "types": []
    }
  ]
}