net (Network)
Status: Planned for 0.9. The
netmodule is not yet available in the current release. This page describes the planned API.
The net module will provide HTTP client functionality and basic socket
communication. It will require --allow net at runtime.
Planned functions
Section titled “Planned functions”httpGet
Section titled “httpGet”Sends an HTTP GET request and returns the response body as a string.
import { httpGet } from net;
int main() { string body = httpGet("https://example.com"); print(body); return 0;}httpPost
Section titled “httpPost”Sends an HTTP POST request with a body and returns the response.
import { httpPost } from net;
int main() { string resp = httpPost("https://example.com/api", "{\"key\":\"value\"}"); print(resp); return 0;}Capability
Section titled “Capability”All net functions require --allow net:
saqut run --allow net program.sqtThe net capability is separate from fs and sys. A program that only
reads files and makes HTTP requests would run with:
saqut run --allow fs,net program.sqtWhen will it be available
Section titled “When will it be available”The net module is planned for version 0.9. Track progress on
GitHub Issues.
