Conversation
Change Headers storage from map[string]string to []Header to preserve header order and allow duplicate headers with different values.
Move response rendering logic to new response_renderer.go with improved box styling using Unicode border characters (╭╮╰╯│┬┴┼├┤). Also refactor viewport sizing logic in tui.go.
📝 WalkthroughWalkthroughHeaders changed from a map to a []Header across parser, client, and executor. UI response rendering was replaced with a new bordered, two-column, viewport-aware renderer and corresponding TUI viewport logic. The GitHub Actions deploy workflow had its explicit permissions block removed. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/client/executor.go`:
- Around line 48-50: The loop that applies request headers currently calls
httpReq.Header.Set which overwrites duplicate header keys; update the header
handling in the loop that iterates over req.Headers (where substitutedValue is
computed via parser.SubstituteVariables(h.Value, e.variables)) to call
httpReq.Header.Add(h.Key, substitutedValue) instead of Set so multiple headers
(e.g., repeated Set-Cookie entries) are preserved.
In `@internal/ui/response_renderer.go`:
- Around line 288-299: The UI renders map entries in non-deterministic order:
collect header keys from result.Response.Headers into a slice, call
sort.Strings(keys) and iterate over that sorted slice when writing headers
(symbols: result.Response.Headers, headerKeyStyle, headerValueStyle); do the
same for usedVars by collecting its map keys into a slice,
sort.Strings(usedKeys) and iterate the sorted keys instead of ranging the map;
also add "sort" to the imports so sort.Strings is available.
- Around line 32-33: The two-column width calculation can produce negative
rightWidth/rightDashes when cw (ContentWidth) is <5, causing strings.Repeat to
panic; in the functions that do this (the block computing leftWidth and
rightWidth and the sibling function renderHeadersTwoColumn) detect very narrow
widths (e.g. cw < 5) and fall back to the single-column rendering path instead
of continuing two-column math, or clamp leftWidth/rightWidth to non-negative
values before calling strings.Repeat; update the code around the
leftWidth/rightWidth computation and any use of rightDashes to perform this
check/clamp so strings.Repeat never receives a negative count.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
.github/workflows/deploy.ymlinternal/client/executor.gointernal/parser/parser.gointernal/parser/types.gointernal/ui/components.gointernal/ui/response_renderer.gointernal/ui/styles.gointernal/ui/tui.gointernal/ui/views.go
💤 Files with no reviewable changes (2)
- .github/workflows/deploy.yml
- internal/ui/components.go
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/ui/response_renderer.go`:
- Around line 279-282: The truncation math can produce negative slice indices
when maxValueLen or rightWidth is 1 or 2; replace the inline slices that do
value = value[:maxValueLen-3] + "..." (used where maxValueLen is computed from
leftWidth and similarly for rightWidth) with the existing safe helper truncate()
(defined earlier) or ensure the guard requires maxValueLen > 3 (and rightWidth >
3) before subtracting 3; update the code paths in response_renderer.go that
compute maxValueLen and rightWidth to call truncate(value, maxValueLen) /
truncate(value, rightWidth) or add the stronger >3 checks to avoid negative
slice bounds.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/ui/response_renderer.go`:
- Line 100: renderBody currently emits raw long lines in the single-column
rendering path which can overflow the viewport and break the box layout; to fix
this, ensure every result body line is wrapped to the viewport width before
being appended to allLines by piping renderBody through wrapSection (i.e.,
replace direct append of renderBody(result) with append of
wrapSection(renderBody(result))) wherever single-column rendering occurs
(reference renderBody, wrapSection, and allLines; apply same change in the other
occurrence around lines 347-370).
Uh oh!
There was an error while loading. Please reload this page.