zed/extensions
Nathan Sobo fc64843dd5
Enhance HTTP API for extensions (#16067)
# HTTP Client Improvements for Extension API

This PR enhances the HTTP client functionality in the Zed extension API,
providing more control over requests and allowing for streaming
responses.

## Key Changes

1. Extended `HttpRequest` struct:
   - Added `method` field to specify HTTP method
   - Added `headers` field for custom headers
   - Added optional `body` field for request payload

2. Introduced `HttpMethod` enum for supported HTTP methods

3. Updated `HttpResponse` struct:
   - Added `headers` field to access response headers
- Changed `body` type from `String` to `Vec<u8>` for binary data support

4. Added streaming support:
   - New `fetch_stream` function to get a response stream
   - Introduced `HttpResponseStream` resource for chunked reading

5. Updated internal implementations to support these new features

6. Modified the Gleam extension to use the new API structure

## Motivation

These changes provide extension developers with more flexibility and
control over HTTP requests. The streaming support is particularly useful
for handling large responses efficiently or ideally streaming into the
UI.

## Testing

- [x] Updated existing tests
- [ ] Added new tests for streaming functionality

## Next Steps

- Consider adding more comprehensive examples in the documentation
- Evaluate performance impact of streaming for large responses

Please review and let me know if any adjustments are needed.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-08-12 10:36:49 -04:00
..
astro astro: Bump to v0.1.0 (#15172) 2024-07-25 08:16:28 -04:00
clojure clojure: Bump to v0.0.3 (#13935) 2024-07-08 11:29:07 -04:00
csharp csharp: Use lsp settings to locate binary if present (#15885) 2024-08-07 10:58:13 -04:00
dart dart: Release 0.0.3 (#14176) 2024-07-11 11:48:04 +02:00
deno deno: Bump to v0.0.2 (#15173) 2024-07-25 08:19:43 -04:00
elixir elixir: Bump to v0.0.7 (#15867) 2024-08-06 13:07:47 -04:00
elm Extract Elm language into an extension (#10432) 2024-04-11 10:23:49 -07:00
emmet emmet: Upgrade zed_extension_api to v0.0.6 (#15177) 2024-07-25 08:34:45 -04:00
erlang erlang: Add support for installing elp language server (#14923) 2024-07-21 12:42:21 -04:00
gleam Enhance HTTP API for extensions (#16067) 2024-08-12 10:36:49 -04:00
glsl glsl: Bump to v0.1.0 (#10734) 2024-04-18 11:57:21 -04:00
haskell haskell: Update author name (#13268) 2024-06-19 10:28:49 -04:00
html assistant: Add annotations to more languages (#15866) 2024-08-07 13:47:21 +02:00
lua lua: Bump to v0.0.3 (#13882) 2024-07-05 14:17:53 -04:00
ocaml ocaml: Bump to v0.0.2 (#13864) 2024-07-05 10:10:54 -04:00
php assistant: Add annotations to more languages (#15866) 2024-08-07 13:47:21 +02:00
prisma prisma: Upgrade zed_extension_api to v0.0.6 (#15180) 2024-07-25 08:46:17 -04:00
purescript purescript: Upgrade zed_extension_api to v0.0.6 (#15181) 2024-07-25 08:55:16 -04:00
racket Clean up whitespace (#10755) 2024-04-23 13:31:21 -04:00
ruby ruby: Bump to v0.1.0 (#15855) 2024-08-06 09:53:02 -04:00
ruff ruff: Refactor language server loading (#15852) 2024-08-06 09:10:18 -04:00
scheme Clean up whitespace (#10755) 2024-04-23 13:31:21 -04:00
snippets snippets: Release 0.0.5 (#13434) 2024-06-24 00:39:42 +02:00
svelte svelte: Bump to v0.0.3 (#14650) 2024-07-17 10:20:50 -04:00
terraform terraform: Bump to v0.0.4 (#15174) 2024-07-25 08:22:28 -04:00
test-extension Use a dedicated test extension in extension tests (#13781) 2024-07-03 11:10:51 -04:00
toml Auto detect some DSLs (#14693) 2024-07-18 04:38:44 +00:00
uiua uiua: Upgrade zed_extension_api to v0.0.6 (#15240) 2024-07-25 20:43:15 -04:00
vue vue: Bump to v0.1.0 (#14748) 2024-07-18 11:39:30 -04:00
zig zig: Bump to v0.1.5 (#15203) 2024-07-25 11:36:50 -04:00
.gitignore Provide wasm extensions with APIs needed for using pre-installed LSP binaries (#9085) 2024-03-08 17:18:06 -05:00