Files
marqdo-extension-conformance/marqdo-net/README.md
T

26 lines
1.3 KiB
Markdown

# marqdo-net reference package
This package composes blocking TCP/TLS resources, bounded Memory and the
shipped UTF-8 and stream helpers. Supply the destination's exact host via
`--allow-net`. The caller owns host selection and any additional address
policy. HTTPS uses the CLI's normal trust store.
- `request(url, method = "GET", body = "", accept = "text/plain")` returns a
Result with the HTTP status, headers and UTF-8 body. HTTP error statuses
are returned as status data. Transport errors follow the CLI's host policy.
- `sse.start/next/close` delivers one event at a time, including the carried
event ID and multiline data. The caller must use the reader returned by
`next` and close it after consumption, early exit, or a recoverable error.
- The reference accepts ASCII HTTP(S) URLs with a DNS name or IPv4 and an
optional numeric port. Supply a URL-encoded path. GET and JSON POST are
supported, with 16 KiB request and 32 KiB response body budgets. SSE
accepts LF and CRLF. The client uses one connection per request and does
not follow redirects.
The package uses the existing blocking socket timeout. Closing a reader stops
future reads. Interrupting an in-flight read requires a later resource protocol.
```sh
marqdo call marqdo-net/demo.mq.md request --arg 'url="http://127.0.0.1:8080/"' --allow-net 127.0.0.1 --json
```