fix: unify RequestOptions forwarding across access, membership, roles, and guild services#146
Open
Neziahtech wants to merge 1 commit into
Open
fix: unify RequestOptions forwarding across access, membership, roles, and guild services#146Neziahtech wants to merge 1 commit into
Neziahtech wants to merge 1 commit into
Conversation
- Changed all service methods to use spread pattern for RequestOptions - Added signal, timeoutMs, and retry options forwarding to access.service.ts - Added signal forwarding to membership.service.ts - Simplified roles.service.ts to always pass options to http.get - Simplified guilds.service.ts to always pass options to http.get - Updated checkAccessBatch to extract only request options (not batch options) - Added comprehensive tests for signal and options forwarding
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.
closes #82
summary
Fixes inconsistent forwarding of per-request options (timeoutMs, retry, signal) to HttpClient across service methods. Some methods only forwarded a subset of options while others spread the full object, causing cancellation signals and timeout overrides to silently no-op in certain code paths.
Problem
HttpClient calls were inconsistent between services:
ts// access.service.ts — only forwards timeoutMs and retry
await this.http.get(url, { timeoutMs: options?.timeoutMs, retry: options?.retry });
// membership.service.ts — spreads the full options object
await this.http.get(url, { ...options });
This meant signal worked in some methods and was silently dropped in others, so AbortController-based cancellation was unreliable depending on which service method was called. There was also no single shared type for request options, so each service either redefined its own shape or imported conflicting versions.
What Changed
Added a single shared RequestOptions type in src/http/http.types.ts (re-exported from src/types/common.ts where applicable) covering timeoutMs, retry, and signal
Updated all public methods in access.service.ts, membership.service.ts, roles.service.ts, and guilds.service.ts to accept RequestOptions and forward it consistently to HttpClient via a single shared helper/spread rather than manually picking fields
Removed duplicate/conflicting local RequestOptions definitions and imports
No changes to public method names, signatures (beyond accepting the shared options type), or response types
Testing
Added cancellation tests (signal + AbortController) for access, membership, roles, and guild service methods
Added per-request timeoutMs override tests confirming the value reaches HttpClient
Added per-request retry override tests confirming the value reaches HttpClient
Verified existing tests for all four services still pass unchanged
Verified no duplicate RequestOptions imports remain (grep check across src/)
Notes
This is a forwarding/plumbing fix only — no behavioral changes to retry logic, timeout logic, or response shapes inside HttpClient itself
Future request-level options can now be added to RequestOptions once and will automatically propagate to all four services.