{
  "classes": [
    {
      "constants": [],
      "types": [],
      "name": "@eryx/http",
      "tags": [],
      "functions": [],
      "properties": [],
      "source": {
        "path": "",
        "line": 0
      },
      "desc": "HTTP/1.1 client and server library.\n\nBuilt on top of `@eryx/_socket` and `@eryx/_ssl`, this module provides\nboth one-shot convenience functions and lower-level connection and\nserver classes for HTTP and HTTPS, with cookie jars, pooled sessions,\nstreaming request and response bodies, multipart/form helpers, and\nHTTP/1.1 trailer support.\n\n**Client - one-shot request:**\n```luau\nlocal http = require(\"@eryx/http\")\n\nlocal response = http.get(\"http://example.com/\")\nprint(response.status, response.reason)\nprint(response.body)\n```\n\n**Client - persistent connection:**\n```luau\nlocal conn = http.HttpConnection.new(\"example.com\", 80)\nconn:request(\"GET\", \"/\")\nlocal resp = conn:getResponse()\nconn:close()\n```\n\n**Cookies:**\n```luau\nlocal jar = http.CookieJar.new()\nhttp.get(\"http://example.com/login\", { cookies = jar })\n-- jar stores Set-Cookie headers; subsequent requests send them back\nhttp.get(\"http://example.com/dashboard\", { cookies = jar })\n```\n\n**Multipart form upload:**\n```luau\nlocal body, contentType = http.multipart({\n    { name = \"field\", value = \"text\" },\n    { name = \"file\", value = data, filename = \"pic.png\" },\n})\nhttp.post(\"http://example.com/upload\", body, {\n    headers = { [\"Content-Type\"] = contentType },\n})\n```\n\n**Session with connection reuse:**\n```luau\nlocal session = http.Session.new({\n    connectTimeout = 2,\n    readTimeout = 10,\n    maxConnectionsPerHost = 4,\n})\nlocal resp = session:get(\"https://example.com/api\")\nsession:close()\n```\n\n**Server:**\n```luau\nlocal server = http.HttpServer.new(function(req, res)\n    res:send(200, \"Hello, world!\")\nend, { port = 8080 })\nserver:listen(function(host, port)\n    print(\"Listening on \" .. host .. \":\" .. tostring(port))\nend)\n```\n\n**HTTPS Server:**\n```luau\nlocal ssl  = require(\"@eryx/_ssl\")\nlocal ctx  = ssl.create_server_context(\"cert.pem\", \"key.pem\")\nlocal server = http.HttpServer.new(handler, { port = 443, sslCtx = ctx })\nserver:listen()\n```\n"
    }
  ]
}