diff --git a/Postman.WebApi.MsBuildTask/CollectionGenerator.cs b/Postman.WebApi.MsBuildTask/CollectionGenerator.cs index f37050d..5dc067b 100644 --- a/Postman.WebApi.MsBuildTask/CollectionGenerator.cs +++ b/Postman.WebApi.MsBuildTask/CollectionGenerator.cs @@ -157,25 +157,20 @@ public PostmanCollection Create(string assemblyFilePath, string environmentKey, } // scrub curly braces from url parameter values - var cleanUrlParameterUrl = _urlParameterVariableRegEx.Replace(apiDescription.RelativePath, "=$1-value"); - - // get path variables from url - var pathVariables = _pathVariableRegEx.Matches(cleanUrlParameterUrl) - .Cast() - .Select(m => m.Value) - .Select(s => s.Substring(1, s.Length - 2)) - .ToDictionary(s => s, s => string.Format("{0}-value", s)); + var pathTokens = apiDescription.RelativePath.Split(new char[] { '?' }, 2); + var path = _pathVariableRegEx.Replace(pathTokens[0], ":$1"); + var queryString = pathTokens.Length > 1 ? _urlParameterVariableRegEx.Replace(pathTokens[1], "=") : string.Empty; // prefix url with postman environment key variable - var url = baseUrl + apiDescription.RelativePath; + var url = path + (pathTokens.Length > 1 ? "?" + queryString : string.Empty); var postmanRequest = new PostmanRequest { CollectionId = postManCollection.Id, Id = Guid.NewGuid(), - Name = apiDescription.RelativePath, + Name = url, Description = ToMarkdown(apiDescription), - Url = url, + Url = baseUrl + url, Method = apiDescription.HttpMethod.Method, Headers = "Content-Type: application/json", RawModeData = sampleData == null ? null : sampleData.Text, @@ -183,7 +178,6 @@ public PostmanCollection Create(string assemblyFilePath, string environmentKey, Time = postManCollection.Timestamp, DescriptionFormat = "markdown", Responses = new Collection(), - PathVariables = pathVariables, Folder = postManFolder.Id }; diff --git a/Postman.WebApi.MsBuildTask/Properties/AssemblyInfo.cs b/Postman.WebApi.MsBuildTask/Properties/AssemblyInfo.cs index 8f661ae..e64afb3 100644 --- a/Postman.WebApi.MsBuildTask/Properties/AssemblyInfo.cs +++ b/Postman.WebApi.MsBuildTask/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("jamesholcomb")] [assembly: AssemblyProduct("Postman.WebApi.MsBuildTask")] -[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,4 +32,4 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.0.1.0")] +[assembly: AssemblyVersion("0.0.2.0")] diff --git a/build/Postman.WebApi.MsBuildTask.targets b/build/Postman.WebApi.MsBuildTask.targets index 388a26c..37df701 100644 --- a/build/Postman.WebApi.MsBuildTask.targets +++ b/build/Postman.WebApi.MsBuildTask.targets @@ -1,7 +1,7 @@  + AssemblyFile="$(SolutionDir)packages\Postman.WebApi.MsBuildTask.0.0.2.0\tools\Postman.WebApi.MsBuildTask.dll">