Expand description

📡 HTTP Request API

API to be able to issue HTTP GET, POST, PUT, DELETE, PATCH requests.

This is useful and powerful to be able to access and communicate with local or internet services.

Security note

Currently there are no limitations on what domains and services can be accessed. But this will change later as more of the Ark capability-based security gets put into place and where modules have to opt-in and request access to minimal possible specific domains and URLs.

To prepare for this, avoid connecting to arbitrary URLs or allow user input of what to connect to when possible. Prefer domains and URLs the module can know statically at compile time, as it may need to declare them in its manifest later to get access to it.

Example usage

require_http_request_api!();

// Get Google's frontpage
let html_bytes = http_get(Url::Static("https://google.com")).unwrap();

Structs

HTTP response object sent back from a server.

Enums

HTTP request method
URL for HTTP requests

Functions

Issue async HTTP CONNECT request
Issue async HTTP DELETE request
Issue async HTTP GET request
Issue async HTTP HEAD request
Issue async HTTP OPTIONS request
Issue async HTTP PATCH request
Issue async HTTP POST request
Issue async HTTP PUT request
Issue async HTTP request of the specific method
Issue async HTTP TRACE request

Type Definitions

The response to any http request served by this API.