diff --git a/ChangeLog.md b/ChangeLog.md index 0667d68c..75ea5541 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,9 @@ # Change Log - oav +## 09/30/2021 2.9.1 + +- Example extractor support add url parameter if define x-ms-parameterized-host + ## 09/30/2021 2.9.0 - Rename test scenario to API scenario diff --git a/lib/xMsExampleExtractor.ts b/lib/xMsExampleExtractor.ts index 0c1181b0..09259169 100644 --- a/lib/xMsExampleExtractor.ts +++ b/lib/xMsExampleExtractor.ts @@ -145,6 +145,7 @@ export class XMsExampleExtractor { const parsedUrl = url.parse(recordingEntry.RequestUri, true); let recordingPath = parsedUrl.href || ""; queryParams = parsedUrl.query || {}; + const hostUrl = parsedUrl ? parsedUrl.protocol! + "//" + parsedUrl.hostname! : undefined; const headerParams = recordingEntry.RequestHeaders; @@ -167,6 +168,9 @@ export class XMsExampleExtractor { const index = v; pathParamsValues[p] = recordingPathParts[index]; } + if (hostUrl !== undefined) { + pathParamsValues.url = hostUrl; + } // found a match in the recording const requestMethodFromRecording = recordingEntry.RequestMethod; @@ -240,7 +244,9 @@ export class XMsExampleExtractor { body: responseBody, }; } - log.info(`Writing x-ms-examples at ${outputExamples + exampleFileName}`); + log.info( + `Writing x-ms-examples at ${pathlib.resolve(outputExamples, exampleFileName)}` + ); const examplePath = pathlib.join(outputExamples, exampleFileName); const dir = pathlib.dirname(examplePath); mkdirRecursiveSync(dir); diff --git a/package-lock.json b/package-lock.json index 47963b00..dbb883bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "oav", - "version": "2.9.0", + "version": "2.9.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8078cc6c..94c91faa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oav", - "version": "2.9.0", + "version": "2.9.1", "author": { "name": "Microsoft Corporation", "email": "azsdkteam@microsoft.com",