-
Notifications
You must be signed in to change notification settings - Fork 238
Open
Labels
Description
Goal
Follow Azure DevOps rate limiting best practices:
"Honor the Retry-After header: If you receive it in a response, wait the specified time before sending another request. The response still returns
HTTP 200, so retry logic isn't required.""Monitor X-RateLimit headers: If available, track X-RateLimit-Remaining and X-RateLimit-Limit to approximate how quickly you're approaching the
threshold."
Reference: https://learn.microsoft.com/en-us/azure/devops/integrate/concepts/rate-limits
Problem
- Response headers are lost here (
ClientApiBases.tspattern used in all generated APIs):
res = await this.rest.get<T>(url, options);
return this.formatResponse(res.result, ...); // res.headers discarded- I can't tell if the library respects these headers internally (doesn't appear to)
Note
RateLimit interface and extractRateLimitHeaders() exist but are never used.
Request
Expose response headers so users can implement proactive throttling.
If there's interest, I'm happy to open a PR. One possible approach:
// New parallel methods in generated APIs (non-breaking)
const response = await coreApi.getProjectsWithResponse();
// response.result = [...]
// response.headers = {...}
// response.rateLimit = { remaining, limit, delay, reset }