@@ -157,33 +157,27 @@ public PostmanCollection Create(string assemblyFilePath, string environmentKey,
157
157
}
158
158
159
159
// scrub curly braces from url parameter values
160
- var cleanUrlParameterUrl = _urlParameterVariableRegEx . Replace ( apiDescription . RelativePath , "=$1-value" ) ;
161
-
162
- // get path variables from url
163
- var pathVariables = _pathVariableRegEx . Matches ( cleanUrlParameterUrl )
164
- . Cast < Match > ( )
165
- . Select ( m => m . Value )
166
- . Select ( s => s . Substring ( 1 , s . Length - 2 ) )
167
- . ToDictionary ( s => s , s => string . Format ( "{0}-value" , s ) ) ;
160
+ var pathTokens = apiDescription . RelativePath . Split ( new char [ ] { '?' } , 2 ) ;
161
+ var path = _pathVariableRegEx . Replace ( pathTokens [ 0 ] , ":$1" ) ;
162
+ var queryString = pathTokens . Length > 1 ? _urlParameterVariableRegEx . Replace ( pathTokens [ 1 ] , "=" ) : string . Empty ;
168
163
169
164
// prefix url with postman environment key variable
170
- var url = baseUrl + apiDescription . RelativePath ;
165
+ var url = path + ( pathTokens . Length > 1 ? "?" + queryString : string . Empty ) ;
171
166
172
167
var postmanRequest = new PostmanRequest
173
168
{
174
169
CollectionId = postManCollection . Id ,
175
170
Id = Guid . NewGuid ( ) ,
176
- Name = apiDescription . RelativePath ,
171
+ Name = url ,
177
172
Description = ToMarkdown ( apiDescription ) ,
178
- Url = url ,
173
+ Url = baseUrl + url ,
179
174
Method = apiDescription . HttpMethod . Method ,
180
175
Headers = "Content-Type: application/json" ,
181
176
RawModeData = sampleData == null ? null : sampleData . Text ,
182
177
DataMode = "raw" ,
183
178
Time = postManCollection . Timestamp ,
184
179
DescriptionFormat = "markdown" ,
185
180
Responses = new Collection < string > ( ) ,
186
- PathVariables = pathVariables ,
187
181
Folder = postManFolder . Id
188
182
} ;
189
183
0 commit comments