mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
fc64843dd5
# 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> |
||
---|---|---|
.. | ||
astro | ||
clojure | ||
csharp | ||
dart | ||
deno | ||
elixir | ||
elm | ||
emmet | ||
erlang | ||
gleam | ||
glsl | ||
haskell | ||
html | ||
lua | ||
ocaml | ||
php | ||
prisma | ||
purescript | ||
racket | ||
ruby | ||
ruff | ||
scheme | ||
snippets | ||
svelte | ||
terraform | ||
test-extension | ||
toml | ||
uiua | ||
vue | ||
zig | ||
.gitignore |