Http:constructor(url, [username], [password])constructor


The Http constructor returns a Http value representing a HTTP client and connect it to the HTTP server at the given URL, using optional basic authentication.

Parameters

url

A string representing a valid URL to connect to the HTTP server.

[username]

An optional string representing a username for basic HTTP authentication.

[password]

An optional string representing a password for basic HTTP authentication.

Return value

The constructor returns a new Http instance.

Example

--! luart-extensions import net local url = "https://www.luart.org" local client = net.Http(url) print("Sucessfully connected to '"..url.."'")