Skip to content

[repo-assist] fix: skip empty Cookie header when no cookie parameters are present#454

Merged
sergey-tihon merged 3 commits into
masterfrom
repo-assist/improve-cookie-header-20260527-da1d142b1568bd53
May 27, 2026
Merged

[repo-assist] fix: skip empty Cookie header when no cookie parameters are present#454
sergey-tihon merged 3 commits into
masterfrom
repo-assist/improve-cookie-header-20260527-da1d142b1568bd53

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

When an API operation has no cookie parameters (the common case), OperationCompiler was always prepending ("Cookie", "") to the headers list. fillHeaders only filters null values, not empty strings, so an empty Cookie: header was sent with every HTTP request.

Root cause

The cookie header construction unconditionally built:

("Cookie", cookieHeader) :: (%headers)

even when cookieHeader was "" (no cookies declared on the operation).

Fix

Only prepend the Cookie header when the constructed cookie string is non-empty:

if String.IsNullOrEmpty cookieHeader then
    %headers
else
    ("Cookie", cookieHeader) :: (%headers)

This means:

  • Operations with cookie parameters: behaviour unchanged
  • Operations without cookie parameters: no spurious Cookie: header sent

Impact

  • Eliminates the unnecessary Cookie: header from every non-cookie API call
  • Reduces request header overhead (minor, but correct)
  • No breaking change: callers using cookie parameters work identically

Test Status

Total: 465, Errors: 0, Failed: 0, Skipped: 1, Time: 1.146s

All 465 unit tests pass. Format check passes (dotnet fantomas --check).

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

Add this agentic workflows to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@298f992955146a6731d380a9de808e17861708e5

When an API operation has no cookie parameters (the common case),
OperationCompiler was always prepending ("Cookie", "") to the headers
list. fillHeaders only filters null values — not empty strings — so
the empty Cookie: header was sent with every request.

Fix: only prepend the Cookie header when cookieHeader is non-empty.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sergey-tihon sergey-tihon marked this pull request as ready for review May 27, 2026 20:55
Copilot AI review requested due to automatic review settings May 27, 2026 20:55
@sergey-tihon sergey-tihon merged commit 9a6a87f into master May 27, 2026
0 of 3 checks passed
@sergey-tihon sergey-tihon deleted the repo-assist/improve-cookie-header-20260527-da1d142b1568bd53 branch May 27, 2026 20:55
@github-actions github-actions Bot review requested due to automatic review settings May 27, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant