From dc3c44363ea8713638ea0b9f64a5d9859a8caaaf Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 22 Feb 2024 14:14:24 -0500 Subject: [PATCH] Apply suggestions from code review --- src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs | 6 +++--- .../Writers/Ruby/CodeMethodWriterTests.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs index 0bad38caf3..8b51bc0e29 100644 --- a/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs +++ b/src/Kiota.Builder/Writers/Ruby/CodeMethodWriter.cs @@ -301,16 +301,16 @@ private void WriteRequestGeneratorBody(CodeMethod codeElement, RequestParams req } if (requestParams.requestBody != null) { - var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeDoubleQuote(); + var sanitizedRequestBodyContentType = codeElement.RequestBodyContentType.SanitizeSingleQuote(); if (requestParams.requestBody.Type.Name.Equals(conventions.StreamTypeName, StringComparison.OrdinalIgnoreCase)) { if (requestParams.requestContentType is not null) writer.WriteLine($"request_info.set_stream_content({requestParams.requestBody.Name}, {requestParams.requestContentType.Name})"); else if (!string.IsNullOrEmpty(sanitizedRequestBodyContentType)) - writer.WriteLine($"request_info.set_stream_content({requestParams.requestBody.Name}, \"{sanitizedRequestBodyContentType}\")"); + writer.WriteLine($"request_info.set_stream_content({requestParams.requestBody.Name}, '{sanitizedRequestBodyContentType}')"); } else if (parentClass.GetPropertyOfKind(CodePropertyKind.RequestAdapter) is CodeProperty requestAdapterProperty) - writer.WriteLine($"request_info.set_content_from_parsable(@{requestAdapterProperty.Name.ToSnakeCase()}, \"{sanitizedRequestBodyContentType}\", {requestParams.requestBody.Name})"); + writer.WriteLine($"request_info.set_content_from_parsable(@{requestAdapterProperty.Name.ToSnakeCase()}, '{sanitizedRequestBodyContentType}', {requestParams.requestBody.Name})"); } } if (parentClass.GetPropertyOfKind(CodePropertyKind.PathParameters) is CodeProperty urlTemplateParamsProperty && diff --git a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs index 5d24252c52..42801436e5 100644 --- a/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs +++ b/tests/Kiota.Builder.Tests/Writers/Ruby/CodeMethodWriterTests.cs @@ -1099,6 +1099,6 @@ public void WritesRequestGeneratorContentTypeQuotes() method.RequestBodyContentType = "application/json; profile=\"CamelCase\""; writer.Write(method); var result = tw.ToString(); - Assert.Contains("\"application/json; profile=\\\"CamelCase\\\"\"", result); + Assert.Contains("'application/json; profile=\\'CamelCase\\''", result); } }