Skip to content

Render multipart/form-data bodies as a parsed JSON view#36

Merged
botre merged 1 commit into
masterfrom
feat/multipart-preview
Jul 16, 2026
Merged

Render multipart/form-data bodies as a parsed JSON view#36
botre merged 1 commit into
masterfrom
feat/multipart-preview

Conversation

@botre

@botre botre commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • File uploads and multi-field forms were shown as raw, boundary-delimited text; renderBody now parses multipart/form-data bodies into an ordered array of parts ({name, value} for fields, {name, filename, contentType, size} for files — file content itself is never shown), reusing the existing JSON highlight path.
  • Falls back unchanged to the existing JSON → XML → raw display chain for anything that isn't well-formed multipart (missing/malformed boundary, non-multipart content type).
  • Split htmlEscape + renderBody out of public/index.js into a new public/render-body.js, since body-rendering is the piece that's actually growing.

Test plan

  • go vet ./... and go test ./...
  • Full Playwright suite (30/30 passing), including 4 new specs: simple fields, a file part (metadata only, no content), repeated field names as separate array entries, and fallback on a missing boundary
  • Manual verification in a real browser (curl-generated multipart requests, screenshot-checked rendering)

File uploads and multi-field forms were previously shown as raw,
boundary-delimited text, making them hard to inspect at a glance.
Parse them client-side into an ordered array of parts instead —
{name, value} for fields, {name, filename, contentType, size} for
files (content itself is never shown). Falls back to the existing
raw display for anything that doesn't parse as well-formed multipart.

Split renderBody/htmlEscape out of index.js into render-body.js
alongside the new parsing logic, since that's the piece actually
growing.
@botre
botre merged commit 2c47229 into master Jul 16, 2026
2 checks passed
@botre
botre deleted the feat/multipart-preview branch July 16, 2026 09:32
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