Fix false 'headers not set' warning on DELETE endpoints#424
Merged
brandon-wada merged 1 commit intomainfrom Apr 15, 2026
Merged
Fix false 'headers not set' warning on DELETE endpoints#424brandon-wada merged 1 commit intomainfrom
brandon-wada merged 1 commit intomainfrom
Conversation
…headers not set"
The check `if not header_param:` incorrectly treats an empty dict {} as
falsy, skipping X-Request-Id injection for every endpoint whose OpenAPI
spec has empty accept and content_type headers. This affects all DELETE
endpoints (delete_detector, delete_priming_group, delete_rule,
reset_detector) and edge_report_metrics_create.
The fix changes the guard to `if header_param is None:` so that an empty
dict correctly falls through to the elif branch and gets the request-id
header set.
timmarkhuff
approved these changes
Apr 15, 2026
Contributor
timmarkhuff
left a comment
There was a problem hiding this comment.
LGTM.
I question whether it should be en error instead of warning. "This will never happen in normal usage." sounds like an error to me.
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.
Summary
if not header_param:inGroundlightApiClient.call_apiincorrectly treats an empty dict{}as falsy, skippingX-Request-Idinjection and logging a spurious warning for every DELETE endpoint (delete_detector,delete_priming_group,delete_rule,reset_detector) andedge_report_metrics_createacceptandcontent_typein their OpenAPI-generatedheaders_map, so no Accept/Content-Type headers are added, leavingparams["header"]as{}if not header_param:toif header_param is None:so an empty dict falls through to theelifbranch and gets theX-Request-Idheader set🤖 Generated with Claude Code
Brandon: Without having to understand the entire generated code path, we can reason that this code change is an improvement. If headers is an empty dict, we still want to inject the request id.
This code is ancient, there's plenty we could improve here but this PR will stick to the minimal change to fix the bug that proper usage can create a warning without much to do about it and cause the request id to not be set