Skip to content

Commit c271c7d

Browse files
committed
Only escape backslash when quote type is double
1 parent 3c0f1ee commit c271c7d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

codegens/curl/lib/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ self = module.exports = {
141141
isAsperandPresent = _.includes(rawBody, '@'),
142142
// Use the long option if `@` is present in the request body otherwise follow user setting
143143
optionName = isAsperandPresent ? '--data-raw' : form('-d', format);
144-
snippet += indent + `${optionName} ${quoteType}${sanitize(rawBody, trim, quoteType, true)}${quoteType}`;
144+
// eslint-disable-next-line max-len
145+
snippet += indent + `${optionName} ${quoteType}${sanitize(rawBody, trim, quoteType, quoteType === '\'')}${quoteType}`;
145146
break;
146147
}
147148

0 commit comments

Comments
 (0)