v2026.5.3
All Bundles
Bundle Shared networking types used across all HTTP libraries: Url (parsing and construction), Response (status code, headers, body), Cookie, and WebDownloader for streaming downloads. Compile with -lib net.

HttpClient

HTTP client

html := HttpClient->QuickGet(Url->New("http://worldtimeapi.org/api/ip"))->ToString();
if(html <> Nil) {
  html->PrintLine();
};

Operations

AddHeader #

Adds a HTTP request header

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

Parameters

NameTypeDescription
nameStringheader name
valueStringheader value

Example

client := Web.HTTP.HttpClient->New();
client->AddHeader("Authorization", "Bearer my-token-123");
client->AddHeader("Accept", "application/json");
response := client->Get(Web.HTTP.Url->New("https://api.example.com/data"));
if(response <> Nil) {
  response->ToString()->PrintLine();
};

Delete #

Performs a HTTP DELETE

method : public : Delete(url:Web.HTTP.Url) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL

Return

TypeDescription
Responsestring read

Example

client := Web.HTTP.HttpClient->New();
response := client->Delete(Web.HTTP.Url->New("https://api.example.com/items/42"));
response->GetStatusCode()->PrintLine();  # 204

Delete #

Performs a HTTP DELETE

method : public : Delete(url:Web.HTTP.Url, content_type:String) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
content_typeStringcontent type

Return

TypeDescription
Responsestring read

Delete #

Performs a HTTP DELETE

method : public : Delete(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post

Return

TypeDescription
Responsestring read

Delete #

Performs a HTTP DELETE

method : public : Delete(url:Web.HTTP.Url, data:Byte[], content_type:String) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post
content_typeStringcontent type

Return

TypeDescription
Responsestring read

EnableCookies #

Sets cookie support

method : public : EnableCookies(cookies_enabled:Bool) ~ Nil

Parameters

NameTypeDescription
cookies_enabledBooltrue if cookies are enabled, false otherwise

Example

client := Web.HTTP.HttpClient->New(false);
client->EnableCookies(true);

Get #

Performs a HTTP GET

method : public : Get(url:Web.HTTP.Url) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL

Return

TypeDescription
Responsestring read

Example

client := Web.HTTP.HttpClient->New();
response := client->Get(Web.HTTP.Url->New("https://httpbin.org/get"));
if(response <> Nil & response->GetStatusCode() = 200) {
  response->ToString()->PrintLine();
};

Get #

Performs a HTTP GET

method : public : Get(url:Web.HTTP.Url, content_type:String) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
content_typeStringcontent type

Return

TypeDescription
Responsestring read

Example

client := Web.HTTP.HttpClient->New();
response := client->Get(Web.HTTP.Url->New("https://api.example.com/data"), "application/json");
if(response <> Nil) {
  response->ToString()->PrintLine();
};

GetCookie #

Get a cookie

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

Parameters

NameTypeDescription
nameStringcookie name

Return

TypeDescription
Cookiefound cookie, Nil otherwise

GetCookies #

Gets the cookies

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

Return

TypeDescription
Vector<Cookie>vector of cookies

Example

client := Web.HTTP.HttpClient->New(true);
client->Get(Web.HTTP.Url->New("https://httpbin.org/cookies/set/session/abc"));
cookies := client->GetCookies();
each(c in cookies) {
  c->GetName()->PrintLine();
};

GetRequestHeaders #

Gets the HTTP request headers

method : public : GetRequestHeaders() ~ Hash<String,String>

Return

TypeDescription
Hash<String,String>HTTP request headers

GetResponseHeaders #

Gets the HTTP response headers

method : public : GetResponseHeaders() ~ Hash<String,String>

Return

TypeDescription
Hash<String,String>HTTP response headers

HasCookie #

Checks for a cookie

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

Parameters

NameTypeDescription
nameStringcookie name

Return

TypeDescription
Booltrue if found cookie, false otherwise

New # constructor

Default constructor

New(cookies_enabled:Bool)

Parameters

NameTypeDescription
cookies_enabledBooltrue if cookies are enabled, false otherwise

Patch #

Performs a HTTP PATCH

method : public : Patch(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to patch

Return

TypeDescription
Responsestring read

Example

client := Web.HTTP.HttpClient->New();
body := "{\"status\":\"active\"}"->ToByteArray();
response := client->Patch(Web.HTTP.Url->New("https://api.example.com/users/5"), body);
response->GetStatusCode()->PrintLine();

Patch #

Performs a HTTP PATCH

method : public : Patch(url:Web.HTTP.Url, data:Byte[], content_type:String) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to patch
content_typeStringcontent type

Return

TypeDescription
Responsestring read

Post #

Performs a HTTPS POST

method : public : Post(url:Web.HTTP.Url, data:Byte[], content_type:String) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to oper
content_typeStringcontent type

Return

TypeDescription
Responsestring read

Example

client := Web.HTTP.HttpClient->New();
body := "{\"user\":\"bob\",\"score\":42}"->ToByteArray();
response := client->Post(
  Web.HTTP.Url->New("https://api.example.com/scores"),
  body,
  "application/json");
response->GetStatusCode()->PrintLine();

Post #

Performs a HTTP POST

method : public : Post(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post

Return

TypeDescription
Responsestring read

Example

client := Web.HTTP.HttpClient->New();
body := "{\"name\":\"Alice\"}"->ToByteArray();
response := client->Post(Web.HTTP.Url->New("https://httpbin.org/post"), body);
if(response <> Nil) {
  response->GetStatusCode()->PrintLine();
};

Put #

Performs a HTTP POST

method : public : Put(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post

Return

TypeDescription
Responsestring read

Example

client := Web.HTTP.HttpClient->New();
body := "{\"name\":\"Updated\"}"->ToByteArray();
response := client->Put(Web.HTTP.Url->New("https://api.example.com/items/1"), body);
response->GetStatusCode()->PrintLine();

Put #

Performs a HTTP POST

method : public : Put(url:Web.HTTP.Url, data:Byte[], content_type:String) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post
content_typeStringcontent type

Return

TypeDescription
Responsestring read

QuickDelete # function

Performs a HTTP DELETE and returns results as a String

function : QuickDelete(url:Web.HTTP.Url) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL

Return

TypeDescription
Responseoutput buffer

QuickDelete # function

Performs a HTTP DELETE and returns results as a String

function : QuickDelete(url:Web.HTTP.Url, headers:Map<String,String>) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
headersMap<String,String>key/value headers

Return

TypeDescription
Responseoutput buffer

QuickDelete # function

Performs a HTTP DELETE and returns results as a String

function : QuickDelete(url:Web.HTTP.Url, content_type:String) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
content_typeStringcontent type

Return

TypeDescription
Responseoutput buffer

QuickDelete # function

Performs a HTTP DELETE and returns results as a String

function : QuickDelete(url:Web.HTTP.Url, content_type:String, headers:Map<String,String>) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
content_typeStringcontent type
headersMap<String,String>key/value headers

Return

TypeDescription
Responseoutput buffer

QuickDelete # function

Performs a HTTP DELETE and returns results as a String

function : QuickDelete(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post

Return

TypeDescription
Responseoutput buffer

QuickDelete # function

Performs a HTTP DELETE and returns results as a String

function : QuickDelete(url:Web.HTTP.Url, data:Byte[], headers:Map<String,String>) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post
headersMap<String,String>key/value headers

Return

TypeDescription
Responseoutput buffer

QuickDelete # function

Performs a HTTP DELETE and returns results as a String

function : QuickDelete(url:Web.HTTP.Url, data:Byte[], content_type:String) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post
content_typeStringcontent type

Return

TypeDescription
Responseoutput buffer

QuickDelete # function

Performs a HTTP DELETE and returns results as a String

function : QuickDelete(url:Web.HTTP.Url, data:Byte[], content_type:String, headers:Map<String,String>) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post
content_typeStringcontent type
headersMap<String,String>key/value headers

Return

TypeDescription
Responseoutput buffer

QuickGet # function

Performs a HTTP GET and returns results as a String

function : QuickGet(url:Web.HTTP.Url) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL

Return

TypeDescription
Responseoutput buffer

Example

response := Web.HTTP.HttpClient->QuickGet(Web.HTTP.Url->New("https://httpbin.org/get"));
if(response <> Nil) {
  response->ToString()->PrintLine();
};

QuickGet # function

Performs a HTTP GET and returns results as a String

function : QuickGet(url:Web.HTTP.Url, headers:Map<String,String>) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
headersMap<String,String>key/value headers

Return

TypeDescription
Responseoutput buffer

Example

hdrs := Collection.Map->New()<String, String>;
hdrs->Insert("Accept", "application/json");
response := Web.HTTP.HttpClient->QuickGet(Web.HTTP.Url->New("https://api.example.com"), hdrs);
response->ToString()->PrintLine();

QuickGet # function

Performs a HTTP GET and returns results as a String

function : QuickGet(url:Web.HTTP.Url, content_type:String) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
content_typeStringcontent type

Return

TypeDescription
Responseoutput buffer

QuickGet # function

Performs a HTTP GET and returns results as a String

function : QuickGet(url:Web.HTTP.Url, content_type:String, headers:Map<String,String>) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
content_typeStringcontent type
headersMap<String,String>key/value headers

Return

TypeDescription
Responseoutput buffer

QuickPatch # function

Performs a HTTP PATCH

function : QuickPatch(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to patch

Return

TypeDescription
Responseread strings

QuickPatch # function

Performs a HTTP PATCH

function : QuickPatch(url:Web.HTTP.Url, data:Byte[], content_type:String) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to patch
content_typeStringcontent type

Return

TypeDescription
Responseread strings

QuickPatch # function

Performs a HTTP PATCH

function : QuickPatch(url:Web.HTTP.Url, data:Byte[], content_type:String, headers:Map<String,String>) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to patch
content_typeStringcontent type
headersMap<String,String>key/value headers

Return

TypeDescription
Responseread strings

QuickPost # function

Performs a HTTP POST

function : QuickPost(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post

Return

TypeDescription
Responseread strings

Example

body := "{\"event\":\"click\"}"->ToByteArray();
response := Web.HTTP.HttpClient->QuickPost(Web.HTTP.Url->New("https://httpbin.org/post"), body);
response->GetStatusCode()->PrintLine();

QuickPost # function

Performs a HTTPS POST

function : QuickPost(url:Web.HTTP.Url, data:Byte[], content_type:String) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post
content_typeStringcontent type

Return

TypeDescription
Responseread strings

Example

body := "{\"x\":1}"->ToByteArray();
response := Web.HTTP.HttpClient->QuickPost(
  Web.HTTP.Url->New("https://api.example.com/events"),
  body,
  "application/json");
response->GetStatusCode()->PrintLine();

QuickPost # function

Performs a HTTP POST

function : QuickPost(url:Web.HTTP.Url, data:Byte[], content_type:String, headers:Map<String,String>) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post
content_typeStringcontent type
headersMap<String,String>key/value headers

Return

TypeDescription
Responseread strings

QuickPut # function

Performs a HTTP POST

function : QuickPut(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post

Return

TypeDescription
Responseread strings

QuickPut # function

Performs a HTTPS POST

function : QuickPut(url:Web.HTTP.Url, data:Byte[], content_type:String) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post
content_typeStringcontent type

Return

TypeDescription
Responseread strings

QuickPut # function

Performs a HTTP POST

function : QuickPut(url:Web.HTTP.Url, data:Byte[], content_type:String, headers:Map<String,String>) ~ Web.HTTP.Response

Parameters

NameTypeDescription
urlUrlURL
dataBytedata to post
content_typeStringcontent type
headersMap<String,String>key/value headers

Return

TypeDescription
Responseread strings

RemoveHeader #

Removes a HTTP request header

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

Parameters

NameTypeDescription
nameStringheader name

Example

client := Web.HTTP.HttpClient->New();
client->AddHeader("X-Debug", "1");
# remove before production call
client->RemoveHeader("X-Debug");

SetCookie #

Sets a cookie

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

Parameters

NameTypeDescription
cookieCookiecookie

SetMaxRedirects #

Sets the maximum number of redirects to follow (default 10)

method : public : SetMaxRedirects(max:Int) ~ Nil

Parameters

NameTypeDescription
maxIntmaximum redirects

Example

client := Web.HTTP.HttpClient->New();
client->SetMaxRedirects(3);

SetRetry #

Sets retry behavior for transient errors (429, 503)

method : public : SetRetry(max_retries:Int, delay_ms:Int) ~ Nil

Parameters

NameTypeDescription
max_retriesIntmaximum retry attempts (default 3, 0 to disable)
delay_msIntinitial delay between retries in milliseconds (default 1000, doubles each retry)

Example

client := Web.HTTP.HttpClient->New();
client->SetRetry(3, 500);  # retry up to 3 times, 500ms between attempts
response := client->Get(Web.HTTP.Url->New("https://api.example.com/items"));