Skip to content

feat: improve ui / ux#26

Merged
aritra1999 merged 6 commits intomainfrom
feature/improve-ux
Feb 26, 2026
Merged

feat: improve ui / ux#26
aritra1999 merged 6 commits intomainfrom
feature/improve-ux

Conversation

@aritra1999
Copy link
Copy Markdown
Owner

@aritra1999 aritra1999 commented Feb 26, 2026

image

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.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 26, 2026

📝 Walkthrough

Walkthrough

Headers 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

Cohort / File(s) Summary
Header type & parsing
internal/parser/types.go, internal/parser/parser.go
Added Header struct; changed Request.Headers from map[string]string to []Header; parser now appends Header{Key, Value} and iterates slice for variable extraction.
Client executor header handling
internal/client/executor.go
Adapted header iteration to slice form; use h.Value for substitution and httpReq.Header.Add(h.Key, ...) (append semantics) instead of Set.
UI rendering refactor
internal/ui/components.go, internal/ui/response_renderer.go, internal/ui/styles.go
Removed legacy response rendering helpers from components.go; added response_renderer.go implementing RenderOpts, RenderResponseContent, borders, two-column layout, wrapping/truncation, masking, and JSON handling; adjusted unexported styles.
TUI viewport & views
internal/ui/tui.go, internal/ui/views.go
Reworked viewport sizing and content assembly: added helpers (contentWidth, boxWidth, viewportHeight, rebuildViewportContent), switched to RenderResponseContent, and updated view rendering to use top/bottom borders and margin-prefixed viewport lines.
CI workflow
.github/workflows/deploy.yml
Removed the explicit permissions block from the deploy workflow, changing effective default workflow permissions.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Parser
participant Executor
participant HTTPClient
participant UIRenderer
participant Viewport

Parser->>Executor: Return parsed Request (contains []Header)
Executor->>HTTPClient: Build http.Request (Add headers from []Header)
HTTPClient->>HTTPClient: Execute request -> receive ExecutionResult
HTTPClient->>UIRenderer: Provide ExecutionResult
UIRenderer->>Viewport: RenderResponseContent(result, opts)
Viewport->>Viewport: SetContent and display with borders

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.41% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'feat: improve ui / ux' is vague and generic, using non-descriptive terms that don't convey specific information about the changeset. Consider a more specific title that highlights the main change, such as 'feat: redesign response viewer with two-column layout' or 'feat: refactor UI rendering pipeline'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description consists only of an image screenshot showing the improved UI, which relates to the changeset's purpose of improving UI/UX.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/improve-ux

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 61f65fb and e6b6988.

📒 Files selected for processing (9)
  • .github/workflows/deploy.yml
  • internal/client/executor.go
  • internal/parser/parser.go
  • internal/parser/types.go
  • internal/ui/components.go
  • internal/ui/response_renderer.go
  • internal/ui/styles.go
  • internal/ui/tui.go
  • internal/ui/views.go
💤 Files with no reviewable changes (2)
  • .github/workflows/deploy.yml
  • internal/ui/components.go

Comment thread internal/client/executor.go Outdated
Comment thread internal/ui/response_renderer.go
Comment thread internal/ui/response_renderer.go
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e6b6988 and cd05a27.

📒 Files selected for processing (2)
  • internal/client/executor.go
  • internal/ui/response_renderer.go

Comment thread internal/ui/response_renderer.go
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd05a27 and 8421a31.

📒 Files selected for processing (1)
  • internal/ui/response_renderer.go

Comment thread internal/ui/response_renderer.go
@aritra1999 aritra1999 merged commit f18d4c2 into main Feb 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant