Skip to content

Conversation

@danpacho
Copy link
Contributor

Description

  • Immutable FetchBuilder: The is now immutable. Methods like or return a new cloned instance instead of mutating the existing one, preventing side effects and making the builder safer to reuse.

  • Full-Cycle Middleware: A new middleware system based on the pattern has been implemented. This allows middleware to inspect and modify both the request and the response, enabling features like logging, caching, and authentication.

  • Lazy Response Parsing: The now receives a function to parse the JSON body () instead of an already-resolved JSON object. This gives developers full control over the raw object, allowing for conditional parsing and better error handling.

  • Intelligent Body Handling: The request body serialization logic has been improved to automatically set the header for JSON objects and pass other body types through unmodified.

Type of Change

  • Bug Fix
  • Enhancement
  • Breaking API Changes
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have verified this change is not present in other open pull requests
  • Existing issues have been referenced (where applicable)
  • Functionality is documented
  • All code style checks pass
  • All new and existing tests pass

danpacho added 3 commits July 16, 2025 16:02
This commit introduces a major architectural refactoring of the  package to improve flexibility, safety, and developer experience.

Key changes include:

- **Immutable FetchBuilder**: The  is now immutable. Methods like  or  return a new cloned instance instead of mutating the existing one, preventing side effects and making the builder safer to reuse.

- **Full-Cycle Middleware**: A new middleware system based on the  pattern has been implemented. This allows middleware to inspect and modify both the request and the response, enabling features like logging, caching, and authentication.

- **Lazy Response Parsing**: The  now receives a function to parse the JSON body () instead of an already-resolved JSON object. This gives developers full control over the raw  object, allowing for conditional parsing and better error handling.

- **Intelligent Body Handling**: The request body serialization logic has been improved to automatically set the  header for JSON objects and pass other body types through unmodified.
@danpacho danpacho merged commit b3333f6 into main Jul 16, 2025
3 checks passed
@danpacho danpacho self-assigned this Jul 16, 2025
@danpacho danpacho added the enhancement New feature or request label Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants