diff --git a/sdk/core/core-client-rest/src/urlHelpers.ts b/sdk/core/core-client-rest/src/urlHelpers.ts index 55a71ba8fdad..17b19efa9c78 100644 --- a/sdk/core/core-client-rest/src/urlHelpers.ts +++ b/sdk/core/core-client-rest/src/urlHelpers.ts @@ -103,7 +103,7 @@ function buildRoutePath( value = encodeURIComponent(pathParam); } - routePath = routePath.replace(/{([^/]+)}/, value); + routePath = routePath.replace(/\{\w+\}/, value); } return routePath; } diff --git a/sdk/core/core-client-rest/test/urlHelpers.spec.ts b/sdk/core/core-client-rest/test/urlHelpers.spec.ts index 09181fe0693f..84cc70370a28 100644 --- a/sdk/core/core-client-rest/test/urlHelpers.spec.ts +++ b/sdk/core/core-client-rest/test/urlHelpers.spec.ts @@ -89,6 +89,14 @@ describe("urlHelpers", () => { assert.equal(result, `https://example.org/foo?existing=hey&foo=1&bar=two`); }); + it("should build url with parenthesis", () => { + const path = "/certificates(thumbprintAlgorithm={thumbprintAlgorithm},thumbprint={thumbprint})"; + const parameters = ["foo", "bar"]; + const result = buildRequestUrl(mockBaseUrl, path, parameters); + + assert.equal(result, `${mockBaseUrl}/certificates(thumbprintAlgorithm=foo,thumbprint=bar)`); + }); + it("should build url with array queries", () => { const testArray = ["ArrayQuery1", "begin!*'();:@ &=+$,/?#[]end", null as any, ""] as string[]; let result = buildRequestUrl(mockBaseUrl, "/foo?existing=hey", [], {