Skip to content

fix: copy-paste and clone losing request URL and body data#62

Open
chirag-bruno wants to merge 1 commit intousebruno:mainfrom
chirag-bruno:fix/copy-paste-request-missing-url
Open

fix: copy-paste and clone losing request URL and body data#62
chirag-bruno wants to merge 1 commit intousebruno:mainfrom
chirag-bruno:fix/copy-paste-request-missing-url

Conversation

@chirag-bruno
Copy link
Copy Markdown
Collaborator

Summary

  • Add renderer:clone-request IPC handler that reads source file from disk for full request data
  • Update pasteItem and cloneItem actions to use the new handler

Problem

When copying/cloning a request via the context menu, the pasted request was missing its URL, body, headers, and other data. Only the name and method were preserved.

Root Cause

The copy-paste flow serialized the item from Redux state using transformRequestToSaveToFilesystem(). However, items in Redux can be partially parsed (meta-only for sidebar performance), where request.url is '', request.body is { mode: 'none' }, etc. The serialized clone inherited this incomplete data.

Solution

Added a renderer:clone-request IPC handler that reads the source .bru/.yml file directly from disk (getting the complete request data), updates the name/seq, and writes the clone. Updated both pasteItem and cloneItem actions to use this handler instead of renderer:new-request.

Test plan

  • Copy a request via context menu → paste in same folder → verify URL, body, headers are preserved
  • Copy a request → paste in different folder → verify full data preserved
  • Clone/duplicate a request → verify full data preserved
  • Copy a partially-loaded request (one that hasn't been opened yet) → paste → verify URL is present
  • TypeScript typecheck passes

JIRA: https://usebruno.atlassian.net/browse/VSCODE-59

When copying/cloning a request, the webview serialized the item from
Redux state which could be only partially parsed (meta-only for sidebar
performance), resulting in empty URL, body, and other request data.

Add a renderer:clone-request IPC handler that reads the source file
from disk to get the full request data, updates name/seq, and writes
the clone. Update pasteItem and cloneItem actions to use this handler
instead of renderer:new-request with potentially incomplete data.
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.

2 participants