feat: full http client with fetch support#15
Merged
Conversation
Joinhack
reviewed
Jul 8, 2025
Joinhack
approved these changes
Jul 8, 2025
There was a problem hiding this comment.
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
uditdc
approved these changes
Jul 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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