You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Idea: cap a response body at the first N lines in a verified .responses file #54
The idea. Let a .http snapshot keep only the first N lines of a response body, so a large API response does not fill a verified file or make it churn.
Why.elastic/docs-builder#4791 needed this and wrote its own scrubber, BodyScrubbers.FirstQuotedLine, which keeps the first line of each quoted text body and replaces the rest with > …, so a page snapshot shows its title and not its content. A built-in option would replace that helper and work for every consumer.
Sketch (not decided, not scheduled):
A per-request directive in the .http file, # @snapshot-lines 20, so the cap travels with the file and a test and snap http run (which share one .verified.responses) cannot disagree. Other .http tools treat it as a comment. Plus a MaxBodyLines option as the default for every response and for single-response MatchHttpSnapshot.
Applied where the body is written, HttpResponseText.AppendBody, so both entry points get it. Text bodies are already quoted with > ; the cut ends in a constant > … line. A constant marker, not "… 412 more lines": a count would change with every content edit and defeat the point.
Open: JSON. A JSON body is written as raw pretty-printed lines and parsed back as a tree, so cutting it at N lines leaves invalid JSON. Quoting it as text past the cap works but changes that section's shape when the cap is crossed. What is wanted instead is a JSONPath-style truncate syntax, such as keeping the first N items of $.items[*], so the body stays valid JSON and keeps tree diffs. That needs its own design.
Also open: a single very long line (minified HTML or JSON) defeats a line cap, so a character cap may be needed.
Activity