Fixes #10540 — Vertical bar character | not escaped in cURL (CMD) request snippet body
Problem
When generating cURL (CMD) request snippets, the vertical bar character | in the request body was not escaped. In Windows CMD, this causes the string after | to be interpreted as a command, resulting in errors.
Solution
Updated the CMD snippet generator to escape | as ^| in the request body. Enabled request snippets in the dev environment for easier testing.
Testing
Verified that the generated cURL (CMD) snippet now escapes | as ^|. Confirmed that pasting the snippet in Windows CMD no longer causes command parsing errors.
Before
After the change=> .replace(/|/g, "^|")
@MichakrawSB Please can you review this pr
Hi @Divyanshu-Mishra9620,
Thanks for this fix! The fix itself seems fine to me, but could you please remove changes unrelated to the issue? Also, could you provide a test for your fix? It should be located under test/unit/core/plugins/request-snippets/fn.js.
Hi @Divyanshu-Mishra9620,
Thanks for this fix! The fix itself seems fine to me, but could you please remove changes unrelated to the issue? Also, could you provide a test for your fix? It should be located under
test/unit/core/plugins/request-snippets/fn.js.
Title: Fix: Escape vertical bar (|) in cURL (CMD) request snippet body (#10540)
Description:
Escapes the vertical bar character | in cURL (CMD) request snippets with a caret ^ for Windows CMD compatibility. Adds a unit test for escapeCMD in fn.js to verify the fix.
Removes unrelated changes and unnecessary files from the PR.
These .LICENSE.txt files in the dist folder are automatically generated by Webpack when building the project.
Testing:
All tests pass, including the new unit test for CMD snippet escaping.
Thanks for the tests! I left a few comments requesting some changes.
As for the changes to files in the
distfolder - they are updated only during the release process, as can be seen in the commit history here.
Hey @glowcloud made the changes as suggested.
@glowcloud Hey i have fixed, if the issue still exist i will work on that.
@glowcloud Hey i have fixed, if the issue still exist i will work on that.
@Divyanshu-Mishra9620 It look like there are still changes unrelated to the bug, have a look at my comment for example.
This PR fixes issue #10540 by ensuring the vertical bar (|) character is properly escaped in CMD request snippets.
- In an earlier commit, I mistakenly changed unrelated logic in the Responses component (removing the nonExtensionResponses filter). This was not related to the vertical bar bug and was an oversight. I have now reverted those changes, and this PR only contains the intended bug fix and its related test.