From b5116c197da3661131a2da522e56d0ed629dbd9a Mon Sep 17 00:00:00 2001 From: Aman Singh <121886615+aman-v-singh@users.noreply.github.com> Date: Fri, 26 Apr 2024 17:38:42 +0530 Subject: [PATCH] Escape special characters in codegen (#734) * CODEGEN-248 escape special characters for curl codegen * Added test * Escape special characters in double quotes * Added test for ruby * Added PowerShell test --- codegens/curl/lib/util.js | 7 ++++ codegens/curl/test/unit/convert.test.js | 34 ++++++++++++++++ codegens/powershell-restmethod/lib/index.js | 7 ++-- codegens/powershell-restmethod/lib/util.js | 17 ++++++++ .../test/unit/convert.test.js | 39 +++++++++++++++++++ codegens/ruby/lib/util/parseBody.js | 4 +- codegens/ruby/lib/util/sanitize.js | 5 +++ codegens/ruby/test/unit/converter.test.js | 33 ++++++++++++++++ 8 files changed, 141 insertions(+), 5 deletions(-) diff --git a/codegens/curl/lib/util.js b/codegens/curl/lib/util.js index 9c7229f68..c9b53af4d 100644 --- a/codegens/curl/lib/util.js +++ b/codegens/curl/lib/util.js @@ -29,6 +29,13 @@ var self = module.exports = { inputString = inputString.replace(/"/g, '\\"'); // Escape backslash if double quote was already escaped before call to sanitize inputString = inputString.replace(/(?