v2026.5.3
All Bundles
Bundle HTTP server framework. WebServer registers route handlers for GET/POST/PUT/DELETE, parses query params and multipart form data, and supports OAuth token exchange. Compile with -lib net_server.

Response

Web server response

Operations

AddCookie #

Adds a cookie

method : public : AddCookie(cookie:Cookie) ~ Nil

Parameters

NameTypeDescription
cookieCookiecookie

Example

session := Web.HTTP.Cookie->New("session", "abc123");
session->AddAttrib("Path", "/");
session->AddAttrib("HttpOnly", Nil);
response->AddCookie(session);
response->SetCodeContent(200, "OK");

GetCode #

Get the response code

method : public : GetCode() ~ Int

Return

TypeDescription
Intresponse code

GetContent #

Get the response content

method : public : GetContent() ~ Byte[]

Return

TypeDescription
Byteresponse content

GetCookie #

Updates a cookie

method : public : GetCookie(name:String) ~ Cookie

Parameters

NameTypeDescription
nameStringcookie name

GetCookies #

Gets all cookies

method : public : GetCookies() ~ Vector<Cookie>

Return

TypeDescription
Vector<Cookie>all cookies

GetForwardAlias #

Gets the forward page alias

method : public : GetForwardAlias() ~ String

Return

TypeDescription
Stringforward page alias

GetHeader #

Gets a response header

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

Parameters

NameTypeDescription
nameStringheader name

Return

TypeDescription
Stringresponse header

GetHeaders #

Gets response headers

method : public : GetHeaders() ~ Map<String,String>

Return

TypeDescription
Map<String,String>response headers

GetReason #

Get the reason string

method : public : GetReason() ~ String

Return

TypeDescription
Stringreason sting

GetStringContent #

Get the response content as string

method : public : GetStringContent() ~ String

Return

TypeDescription
Stringresponse content as string

HasContent #

Checks for request body content

method : public : HasContent() ~ Bool

Return

TypeDescription
Booltrue if content exists, false otherwise

HasForwardAlias #

Checks the forward page alias

method : public : HasForwardAlias() ~ Bool

Return

TypeDescription
Booltrue if forward page alias exists, false otherwise

HasHeader #

Check for a response header

method : public : HasHeader(name:String) ~ Bool

Parameters

NameTypeDescription
nameStringheader name

Return

TypeDescription
Booltrue if header exists, false otherwise

HasStaticHandler #

Check to see if the response has configured handler

method : public : HasStaticHandler() ~ Bool

Return

TypeDescription
Booltrue if handler exists, false otherwise

New # constructor

Constructor

New(server_config:WebServerConfig, request_path:String)

Parameters

NameTypeDescription
server_configWebServerConfigweb server configuration
request_pathStringHTTP request path

RemoveCookie #

Removes a cookie

method : public : RemoveCookie(name:String) ~ Nil

Parameters

NameTypeDescription
nameStringcookie name

RemoveHeader #

Removed a response header

method : public : RemoveHeader(name:String) ~ Nil

Parameters

NameTypeDescription
nameStringheader name

SetCode #

Set response code

method : public : SetCode(code:Int) ~ Nil

Parameters

NameTypeDescription
codeIntresponse code

SetCodeContent #

Set response code and content

method : public : SetCodeContent(code:Int, content:Byte[]) ~ Nil

Parameters

NameTypeDescription
codeIntresponse code
contentByteresponse content

Example

# inside ProcessGet — send a 200 response with HTML body:
html := "<html><body>Hello!</body></html>";
response->SetCodeContent(200, html);

SetCodeContent #

Set response code and content

method : public : SetCodeContent(code:Int, content:String) ~ Nil

Parameters

NameTypeDescription
codeIntresponse code
contentStringresponse content

SetCodeContentCompression #

Set response code, content and compression type

method : public : SetCodeContentCompression(code:Int, content:String, compression:Compression) ~ Nil

Parameters

NameTypeDescription
codeIntresponse code
contentStringresponse content
compressionCompressionresponse compression (br = Brotli, deflate = zlib, gzip = GNU zip)

SetCodeContentCompression #

Set response code, content and compression type

method : public : SetCodeContentCompression(code:Int, content:Byte[], compression:Compression) ~ Nil

Parameters

NameTypeDescription
codeIntresponse code
contentByteresponse content
compressionCompressionresponse compression (br = Brotli, deflate = zlib, gzip = GNU zip)

SetCodeType #

Set response code and type

method : public : SetCodeType(code:Int, type:String) ~ Nil

Parameters

NameTypeDescription
codeIntresponse code
typeStringcontent type

SetCodeTypeContent #

Set response code, type and content

method : public : SetCodeTypeContent(code:Int, type:String, content:Byte[]) ~ Nil

Parameters

NameTypeDescription
codeIntresponse code
typeStringcontent type
contentByteresponse content

Example

# inside ProcessGet — send a JSON response:
json := "{\"status\":\"ok\"}"->ToByteArray();
response->SetCodeTypeContent(200, "application/json", json);

SetCodeTypeContent #

Set response code and content

method : public : SetCodeTypeContent(code:Int, type:String, content:String) ~ Nil

Parameters

NameTypeDescription
codeIntresponse code
typeStringcontent type
contentStringresponse content

SetCompression #

Set the response compression, should be called after the content is set

method : public : SetCompression(compression:Compression) ~ Nil

Parameters

NameTypeDescription
compressionCompressionresponse compression (br = Brotli, deflate = zlib, gzip = GNU zip)

Example

response->SetContent("<html>Hello</html>");
response->SetCompression(Web.HTTP.Server.Response->Compression->GZIP);
response->SetCode(200);

SetContent #

Set response content

method : public : SetContent(content:Byte[]) ~ Nil

Parameters

NameTypeDescription
contentByteresponse content

SetContent #

Set response code

method : public : SetContent(content:String) ~ Nil

Parameters

NameTypeDescription
contentStringresponse content

SetContentCompression #

Set content and compression type

method : public : SetContentCompression(content:String, compression:Compression) ~ Nil

Parameters

NameTypeDescription
contentStringresponse content
compressionCompressionresponse compression (br = Brotli, deflate = zlib, gzip = GNU zip)

SetContentCompression #

Set content and compression type

method : public : SetContentCompression(content:Byte[], compression:Compression) ~ Nil

Parameters

NameTypeDescription
contentByteresponse content
compressionCompressionresponse compression (br = Brotli, deflate = zlib, gzip = GNU zip)

SetContentType #

Sets the content type

method : public : SetContentType(type:String) ~ Nil

Parameters

NameTypeDescription
typeStringcontent type

SetForwardAlias #

Set the forward page alias

method : public : SetForwardAlias(name:String) ~ Bool

Parameters

NameTypeDescription
nameStringforward page alias

Return

TypeDescription
Booltrue if set, false otherwise

SetHeader #

Sets a response header

method : public : SetHeader(name:String, value:String) ~ Nil

Parameters

NameTypeDescription
nameStringheader name
valueStringheader value

SetReason #

Set response reason

method : public : SetReason(reason:String) ~ Nil

Parameters

NameTypeDescription
reasonStringresponse reason

Example

# redirect with a reason URL
response->SetCode(302);
response->SetReason("https://example.com/new-location");

ToString #

Get the reason string

method : public : ToString() ~ String

Return

TypeDescription
Stringreason sting