zed/crates/extension_api/wit/since_v0.0.7/http-client.wit
Marshall Bowers 3419f5fc42
zed_extension_api: Add fetch (#13716)
This PR adds a new `fetch` function to the `zed_extension_api` to allow
fetching a URL through the Wasm host.

Currently we only support GET requests and return the response body as a
string.

Release Notes:

- N/A
2024-07-01 16:58:00 -04:00

16 lines
403 B
Text

interface http-client {
/// An HTTP request.
record http-request {
/// The URL to which the request should be made.
url: string,
}
/// An HTTP response.
record http-response {
/// The response body.
body: string,
}
/// Performs an HTTP request and returns the response.
fetch: func(req: http-request) -> result<http-response, string>;
}