Skip to content

Conversation

@zees-dev
Copy link
Contributor

@zees-dev zees-dev commented Jul 8, 2025

Description

This pull request introduces significant changes to the blockless-sdk dependency, 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:

  • Updated the blockless-sdk dependency in Cargo.toml to 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:

  • Added a detailed example in examples/fetch.js demonstrating 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:

  • Removed the src/fetch/blockless.rs file, which contained legacy Rust code for HTTP handling, including the BlocklessHttp struct, HttpOptions, and related functions. This cleanup eliminates unused code and reduces technical debt.

Pre-requisites

@zees-dev zees-dev requested a review from Copilot July 14, 2025 03:09
Copy link

Copilot AI left a 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-sdk on crates.io to a Git revision in Cargo.toml
  • Introduced src/fetch/mod.rs with a full fetch client and response builder
  • Added src/fetch/fetch.js polyfill and examples/fetch.js demo, and removed legacy src/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 fetch implementation 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

@zees-dev zees-dev merged commit 42a1091 into main Jul 15, 2025
1 check failed
@zees-dev zees-dev deleted the feat/full-http-client-with-fetch-support branch July 15, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants