v2026.5.3
All Bundles
Bundle Lightweight embedded web server. Handles inbound HTTP requests with typed access to method, path, headers, and body; Response supports content-type, compression, redirects, and cookies. Compile with -lib net_server.

Request

Web request

Operations

GetHeader #

Gets a HTTP header

method : public : GetHeader(name:String) ~ String

Parameters

NameTypeDescription
nameStringheader name

Return

TypeDescription
Stringheader value

Example

content_type := request->GetHeader("Content-Type");
if(content_type <> Nil) {
  content_type->PrintLine();  # application/json
};

GetLocalAddress #

Gets a the local address

method : public : GetLocalAddress() ~ String

Return

TypeDescription
Stringlocal address

Example

local := request->GetLocalAddress();
local->PrintLine();  # e.g. 0.0.0.0:8080

GetMethod #

Gets the request method

method : public : GetMethod() ~ Request->Method

Return

TypeDescription
Request->Methodrequest method

Example

# inside a web server handler:
method := request->GetMethod();
if(method = Web.Server.Request->Method->GET) {
  response->WriteBody("Hello from GET");
} else if(method = Web.Server.Request->Method->POST) {
  body := request->ReadBody();
  response->WriteBody(String->New(body));
};

GetRemoteAddress #

Gets a the remote address

method : public : GetRemoteAddress() ~ String

Return

TypeDescription
Stringremote address

Example

addr := request->GetRemoteAddress();
addr->PrintLine();  # e.g. 192.168.1.10

GetRequestUrl #

Gets a the remote address

method : public : GetRequestUrl() ~ String

Return

TypeDescription
Stringremote address

Example

# log the full request URL in a handler:
url := request->GetRequestUrl();
url->PrintLine();  # e.g. /api/users?page=2

ParseMultipartEncoding # native

Parses multipart encoding

function : native : ParseMultipartEncoding(encoded:Byte[]) ~ Vector<ContentType>

Parameters

NameTypeDescription
encodedByteencoded bytes

Return

TypeDescription
Vector<ContentType>content parts

ParseUrlEncoding # function

Parses URL encoding

function : ParseUrlEncoding(encoded:String) ~ Map<String,String>

Parameters

NameTypeDescription
encodedStringencoded bytes

Return

TypeDescription
Map<String,String>name value pairs

Example

body := String->New(request->ReadBody());
params := Web.Server.Request->ParseUrlEncoding(body);
params->Find("username")->PrintLine();  # e.g. alice
params->Find("password")->PrintLine();  # e.g. secret

ReadBody #

Reads the request body (i.e. POST)

method : public : ReadBody() ~ Byte[]

Return

TypeDescription
Byterequest body

Example

if(request->GetMethod() = Web.Server.Request->Method->POST) {
  body := request->ReadBody();
  text := String->New(body);
  text->PrintLine();
};