feat(api): Apply custom headers from the api command - #6
Conversation
The api command defined a --header/-H flag but discarded its value (_ = headers), so custom headers were never sent. Add RequestWithHeaders to the client, parse key:value headers in the api command, and apply them to the outgoing request. Header values are also preserved across GET retries by cloning the original request headers onto the rebuilt request.
|
Warning Review limit reached
Next review available in: 55 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
gt apiadvertised a--header/-Hflag, but the handler discarded it with_ = headers, so custom headers were never sent. This wires the flag through to the request. Useful for endpoints that need a non-defaultAccept,Content-Type, or other header.Changes
internal/api/client.goRequestWithHeaders;Requestnow delegates to it with no extra headers, preserving the existing signature.doWithRetry.internal/cmd/api.go-H key:valueheaders and pass them toRequestWithHeadersfor both the DELETE and general paths.splitHeader, which splits on the first colon and validates a non-empty key.Test plan
go build ./...cleango vet ./internal/api/ ./internal/cmd/cleango test ./internal/api/ ./internal/cmd/ -run TestApipass (8/8 api command tests)