diff --git a/Rest.Net/CodeWriter.cs b/Rest.Net/CodeWriter.cs index 35d580f..3da083c 100644 --- a/Rest.Net/CodeWriter.cs +++ b/Rest.Net/CodeWriter.cs @@ -406,6 +406,18 @@ namespace MontoyaTech.Rest.Net return this; } + /// + /// Returns the last character written to the writer if there was one, otherwise it returns character 0. + /// + /// + public char Peek() + { + if (this.Builder.Length > 0) + return this.Builder[this.Builder.Length - 1]; + else + return (char)0; + } + /// /// Gets all the written data from the writer. /// diff --git a/Rest.Net/Rest.Net.csproj b/Rest.Net/Rest.Net.csproj index 4ca1ce1..f47856b 100644 --- a/Rest.Net/Rest.Net.csproj +++ b/Rest.Net/Rest.Net.csproj @@ -17,7 +17,7 @@ MontoyaTech.Rest.Net MontoyaTech.Rest.Net True - 1.7.0 + 1.7.1 Logo_Symbol_Black_Outline.png diff --git a/Rest.Net/RestCSharpClientGenerator.cs b/Rest.Net/RestCSharpClientGenerator.cs index b3030f0..5873498 100644 --- a/Rest.Net/RestCSharpClientGenerator.cs +++ b/Rest.Net/RestCSharpClientGenerator.cs @@ -448,10 +448,11 @@ namespace MontoyaTech.Rest.Net int argumentIndex = 0; foreach (var component in components) { - if (!string.IsNullOrWhiteSpace(component)) - { + if (writer.Peek() != '/') writer.Write('/'); + if (!string.IsNullOrWhiteSpace(component)) + { if (component.StartsWith("{")) { writer.Write("{").Write(parameters[argumentIndex++ + 1].Name).Write("}"); diff --git a/Rest.Net/RestJavascriptClientGenerator.cs b/Rest.Net/RestJavascriptClientGenerator.cs index 10b68ea..7b3be37 100644 --- a/Rest.Net/RestJavascriptClientGenerator.cs +++ b/Rest.Net/RestJavascriptClientGenerator.cs @@ -549,10 +549,11 @@ namespace MontoyaTech.Rest.Net int argumentIndex = 0; foreach (var component in components) { - if (!string.IsNullOrWhiteSpace(component)) - { + if (writer.Peek() != '/') writer.Write('/'); + if (!string.IsNullOrWhiteSpace(component)) + { if (component.StartsWith("{")) { writer.Write("${").Write(parameters[argumentIndex++ + 1].Name).Write("}");