-
Notifications
You must be signed in to change notification settings - Fork 4
feat: full http client with fetch support #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR replaces the legacy Rust HTTP handler with a fetch-compliant Rust implementation (bless_fetch_request), adds a full JavaScript polyfill for fetch, Request, Response, Headers, and FormData, provides a detailed example script, and updates dependencies and CI matrix.
- Swapped
blockless-sdkon crates.io to a Git revision in Cargo.toml - Introduced
src/fetch/mod.rswith a fullfetchclient and response builder - Added
src/fetch/fetch.jspolyfill andexamples/fetch.jsdemo, and removed legacysrc/fetch/blockless.rs
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/fetch/mod.rs | New Rust fetch implementation, option parsing, JS response creation |
| src/fetch/fetch.js | JavaScript fetch polyfill with Request, Response, Headers, FormData |
| src/fetch/blockless.rs | Removed legacy HTTP binding |
| examples/fetch.js | Comprehensive fetch usage examples |
| Cargo.toml | Updated blockless-sdk to a Git revision |
| .github/workflows/release.yml | Adjusted build matrix ordering and targets |
Comments suppressed due to low confidence (3)
examples/fetch.js:107
- The new
fetchimplementation has many code paths (FormData, ArrayBuffer, JSON, etc.) but there are no tests covering these branches; consider adding unit tests or example snippets that exercise each path.
const multiHeaders = new Headers();
.github/workflows/release.yml:22
- There is a trailing comma in the flow-style YAML list; while some parsers allow it, it can cause CI failures—please verify YAML validity or remove the trailing comma.
{ name: 'full', features: '--all-features' },
src/fetch/mod.rs:10
- [nitpick] Public functions and types (like
bless_fetch_request,FetchOptions,BodyInit) lack module-level or doc comments explaining their purpose—consider adding top-level documentation for maintainability.
/// A fetch-compliant HTTP client
Description
This pull request introduces significant changes to the
blockless-sdkdependency, adds a new comprehensive example for the fetch API, and removes legacy Rust code related to HTTP handling. Below is a summary of the most important updates:Dependency Updates:
blockless-sdkdependency inCargo.tomlto use a specific Git revision (368b6b81) from the repository instead of a versioned release. This ensures the project uses the latest code from the SDK's source.New Examples:
examples/fetch.jsdemonstrating the use of a fetch-compliant wrapper around the HTTP client. This includes multiple use cases such as GET, POST, PUT, DELETE, PATCH requests, error handling, response cloning, and headers manipulation.Codebase Simplification:
src/fetch/blockless.rsfile, which contained legacy Rust code for HTTP handling, including theBlocklessHttpstruct,HttpOptions, and related functions. This cleanup eliminates unused code and reduces technical debt.Pre-requisites