api icon indicating copy to clipboard operation
api copied to clipboard

feat: enhance ConfigOptions to include init parameter for fetch requests

Open Magi1053 opened this issue 5 months ago • 0 comments

🚥 Resolves #1046

🧰 Changes

This PR adds support for passing custom init options to the fetch request in the API core.

  • The ConfigOptions interface now includes an optional init property, allowing users to specify additional RequestInit options.
  • The APICore class now merges config.init into the fetch request's init object, ensuring user-supplied options are respected (except for signal, which is managed internally).

🧬 QA & Testing

  1. Set up an instance of APICore and pass custom init options (e.g., custom headers or credentials) via setConfig({ init: { ... } }).
  2. Make a request using fetch or fetchOperation.
  3. Verify that the custom init options are present in the outgoing request (except for signal).
  4. Ensure that the request still respects the internal timeout and abort logic.
  5. Run the existing test suite to confirm no regressions.

Magi1053 avatar Aug 16 '25 23:08 Magi1053