From 052809688e099c05bd6e9d9698f2de5b994b05ec Mon Sep 17 00:00:00 2001 From: Artem Yarulin Date: Fri, 22 Jun 2018 12:28:59 +0300 Subject: [PATCH 1/3] URL escape paramters --- src/execute/oas3/parameter-builders.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/execute/oas3/parameter-builders.js b/src/execute/oas3/parameter-builders.js index 2a9011c47..3b33458ce 100644 --- a/src/execute/oas3/parameter-builders.js +++ b/src/execute/oas3/parameter-builders.js @@ -14,7 +14,7 @@ function path({req, value, parameter}) { value, style: style || 'simple', explode: explode || false, - escape: false, + escape: true, }) req.url = req.url.replace(`{${name}}`, styledValue) From 64f1aad578a23c896957ea4867a9fabfd250ba85 Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Fri, 17 Aug 2018 18:54:14 -0700 Subject: [PATCH 2/3] modify tests to check value escaping --- test/oas3/execute/style-explode/path.js | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/oas3/execute/style-explode/path.js b/test/oas3/execute/style-explode/path.js index ac70e8289..c4c4ad808 100644 --- a/test/oas3/execute/style-explode/path.js +++ b/test/oas3/execute/style-explode/path.js @@ -35,13 +35,13 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = spec, operationId: 'myOperation', parameters: { - id: 5 + id: "wow!" } }) expect(req).toEqual({ method: 'GET', - url: '/path/5', + url: '/path/wow%21', credentials: 'same-origin', headers: {}, }) @@ -76,13 +76,13 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = spec, operationId: 'myOperation', parameters: { - id: 5 + id: 'wow!' } }) expect(req).toEqual({ method: 'GET', - url: '/path/5', + url: '/path/wow%21', credentials: 'same-origin', headers: {}, }) @@ -115,13 +115,13 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = spec, operationId: 'myOperation', parameters: { - id: 5 + id: 'wow!' } }) expect(req).toEqual({ method: 'GET', - url: '/path/5', + url: '/path/wow%21', credentials: 'same-origin', headers: {}, }) @@ -155,13 +155,13 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = spec, operationId: 'myOperation', parameters: { - id: 5 + id: 'wow!' } }) expect(req).toEqual({ method: 'GET', - url: '/path/.5', + url: '/path/.wow%21', credentials: 'same-origin', headers: {}, }) @@ -194,13 +194,13 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = spec, operationId: 'myOperation', parameters: { - id: 5 + id: 'wow!' } }) expect(req).toEqual({ method: 'GET', - url: '/path/.5', + url: '/path/.wow%21', credentials: 'same-origin', headers: {}, }) @@ -234,13 +234,13 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = spec, operationId: 'myOperation', parameters: { - id: 5 + id: 'wow!' } }) expect(req).toEqual({ method: 'GET', - url: '/path/;id=5', + url: '/path/;id=wow%21', credentials: 'same-origin', headers: {}, }) @@ -273,13 +273,13 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = spec, operationId: 'myOperation', parameters: { - id: 5 + id: 'wow!' } }) expect(req).toEqual({ method: 'GET', - url: '/path/;id=5', + url: '/path/;id=wow%21', credentials: 'same-origin', headers: {}, }) From b3dfed638799e604134197bb340758e1595f913a Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Fri, 17 Aug 2018 18:57:08 -0700 Subject: [PATCH 3/3] linter fixes Signed-off-by: Kyle Shockey --- test/oas3/execute/style-explode/path.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/oas3/execute/style-explode/path.js b/test/oas3/execute/style-explode/path.js index c4c4ad808..8aba4974e 100644 --- a/test/oas3/execute/style-explode/path.js +++ b/test/oas3/execute/style-explode/path.js @@ -35,7 +35,7 @@ describe('OAS 3.0 - buildRequest w/ `style` & `explode` - path parameters', () = spec, operationId: 'myOperation', parameters: { - id: "wow!" + id: 'wow!' } })