All Bundles

HttpClient

HTTP client

Operations

Code example:

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

New

Default constructor

New(cookies_enabled:Bool)
Parameters
NameTypeDescription
cookies_enabledBooltrue if cookies are enabled, false otherwise

AddHeader

Adds a HTTP request header

method : public : AddHeader(name:String, value:String) ~ Nil
Parameters
NameTypeDescription
nameStringheader name
valueStringheader value

Delete

Performs a HTTP DELETE

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

Return
TypeDescription
Responsestring read

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

Performs a HTTP DELETE

method : public : Delete(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response
Parameters
NameTypeDescription
urlUrlURL
dataByte[]data to post

Return
TypeDescription
Responsestring read

Performs a HTTP DELETE

method : public : Delete(url:Web.HTTP.Url, data:Byte[], content_type:String) ~ Web.HTTP.Response
Parameters
NameTypeDescription
urlUrlURL
dataByte[]data 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

Get

Performs a HTTP GET

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

Return
TypeDescription
Responsestring read

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

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

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

Post

Performs a HTTPS POST

method : public : Post(url:Web.HTTP.Url, data:Byte[], content_type:String) ~ Web.HTTP.Response
Parameters
NameTypeDescription
urlUrlURL
dataByte[]data to oper
content_typeStringcontent type

Return
TypeDescription
Responsestring read

Performs a HTTP POST

method : public : Post(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response
Parameters
NameTypeDescription
urlUrlURL
dataByte[]data to post

Return
TypeDescription
Responsestring read

Put

Performs a HTTP POST

method : public : Put(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response
Parameters
NameTypeDescription
urlUrlURL
dataByte[]data to post

Return
TypeDescription
Responsestring read

Performs a HTTP POST

method : public : Put(url:Web.HTTP.Url, data:Byte[], content_type:String) ~ Web.HTTP.Response
Parameters
NameTypeDescription
urlUrlURL
dataByte[]data to post
content_typeStringcontent type

Return
TypeDescription
Responsestring read

QuickDelete

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

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

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

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

Performs a HTTP DELETE and returns results as a String

function : QuickDelete(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response
Parameters
NameTypeDescription
urlUrlURL
dataByte[]data to post

Return
TypeDescription
Responseoutput buffer

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
dataByte[]data to post
headersMap<String,String>key/value headers

Return
TypeDescription
Responseoutput buffer

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
dataByte[]data to post
content_typeStringcontent type

Return
TypeDescription
Responseoutput buffer

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
dataByte[]data to post
content_typeStringcontent type
headersMap<String,String>key/value headers

Return
TypeDescription
Responseoutput buffer

QuickGet

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

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

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

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

QuickPost

Performs a HTTP POST

function : QuickPost(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response
Parameters
NameTypeDescription
urlUrlURL
dataByte[]data to post

Return
TypeDescription
Responseread strings

Performs a HTTPS POST

function : QuickPost(url:Web.HTTP.Url, data:Byte[], content_type:String) ~ Web.HTTP.Response
Parameters
NameTypeDescription
urlUrlURL
dataByte[]data to post
content_typeStringcontent type

Return
TypeDescription
Responseread strings

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
dataByte[]data to post
content_typeStringcontent type
headersMap<String,String>key/value headers

Return
TypeDescription
Responseread strings

QuickPut

Performs a HTTP POST

function : QuickPut(url:Web.HTTP.Url, data:Byte[]) ~ Web.HTTP.Response
Parameters
NameTypeDescription
urlUrlURL
dataByte[]data to post

Return
TypeDescription
Responseread strings

Performs a HTTPS POST

function : QuickPut(url:Web.HTTP.Url, data:Byte[], content_type:String) ~ Web.HTTP.Response
Parameters
NameTypeDescription
urlUrlURL
dataByte[]data to post
content_typeStringcontent type

Return
TypeDescription
Responseread strings

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
dataByte[]data 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

SetCookie

Sets a cookie

method : public : SetCookie(cookie:Cookie) ~ Nil
Parameters
NameTypeDescription
cookieCookiecookie