feature: add copy-as-code-snippet for requests on the Send page#243
Open
komen205 wants to merge 1 commit into
Open
feature: add copy-as-code-snippet for requests on the Send page#243komen205 wants to merge 1 commit into
komen205 wants to merge 1 commit into
Conversation
Adds a copy button to the Send request line that opens a menu of code snippet formats, mirroring the View page's export context menu. The snippet is generated directly from the in-progress request input, so requests can be exported as code while editing, before they're sent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
|
komen205
commented
Jun 11, 2026
| : undefined; | ||
|
|
||
| const menuItems: Array<ContextMenuItem<void>> = [ | ||
| ...(!isPaidUser ? [ |
Author
There was a problem hiding this comment.
Not sure if this is worth to keep, the whole feature is already gated anyway.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What
Adds the ability to copy a request as a code snippet directly from the Send page, while editing it — without having to send it first and export from the View page.
A new copy button sits in the Send request line (between the URL input and the Send button). Clicking it opens a menu mirroring the View page's export context menu:
Picking a format from the submenu copies the snippet and updates the persisted preferred format (
uiStore.exportSnippetFormat), same as the View page behaviour.How
generateHarRequestFromRequestData()inhar.tsbuilds anExtendedHarRequestfrom not-yet-sent request data (decoded body, raw headers, HTTP/1.1), reusing the existing cookie parsing, postData generation, and non-UTF8 body fallback.generateCodeSnippetFromRequestInput()inexport.tsfeeds that through the same HAR-simplification + httpsnippet conversion as the existing View-page path, which was refactored into a shared helper so both stay in sync (content-length/content-encoding/H2 pseudo-header dropping etc).Tests
Added
test/unit/model/ui/export.spec.tscovering snippet generation from request inputs: simple GET, POST with body (content-length dropped), content-encoding dropped with decoded body used, and a clear failure for invalid URLs. Full unit suite passes (894 tests).🤖 Generated with Claude Code