Skip to content

Conversation

@njg7194
Copy link

@njg7194 njg7194 commented Feb 1, 2026

Summary

This PR fixes the issue where the vertical bar character (|) in the request body is not escaped in cURL (CMD) snippets.

Problem

As described in #10540, when the request body contains a pipe character, the generated cURL command fails in Windows CMD because it is interpreted as a pipe operator.

Solution

Added .replace(/\|/g, "^|") to the escapeCMD function to escape pipe characters with a caret (^).

Related Issue

Fixes #10540

The vertical bar character (|) is a special character in Windows CMD that
is used for piping commands. When the request body contains a pipe character,
the generated cURL command fails because CMD interprets it as a pipe operator.

This fix escapes the pipe character with a caret (^|) in the escapeCMD function,
consistent with how other special characters like ^ and newlines are handled.

Fixes swagger-api#10540
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.

Vertical bar character | is not escaped in cURL (CMD) request snipped body

1 participant