Skip to content

Commit b8ff772

Browse files
pollen8Rob Clayburnphryneas
authored
correct sanitization of querystring parameters, test (#65)
Co-authored-by: Rob Clayburn <[email protected]> Co-authored-by: Lenz Weber <[email protected]>
1 parent 7c075c4 commit b8ff772

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

test/cli.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,12 @@ describe('CLI options testing', () => {
342342

343343
expect(fs.readFileSync(fileName, { encoding: 'utf-8' })).toMatchSnapshot();
344344
});
345+
346+
it('should use brackets in a querystring urls arg, when the arg contains full stops', async () => {
347+
const fileName = getTmpFileName();
348+
const result = await cli(['-h', `./test/fixtures/params.json`], '.');
349+
expect(result.stdout).toContain('`/api/v1/list/${queryArg["item.id"]}`');
350+
});
345351
});
346352

347353
describe('yaml parsing', () => {

test/fixtures/params.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "Params test",
5+
"version": "0.1"
6+
},
7+
"schemes": ["https"],
8+
"consumes": ["application/json"],
9+
"produces": ["application/json"],
10+
"paths": {
11+
"/api/v1/list/{item.id}": {
12+
"patch": {
13+
"responses": {
14+
"200": {
15+
"description": "A successful response.",
16+
"schema": {
17+
"type": "string"
18+
}
19+
}
20+
},
21+
"parameters": [
22+
{
23+
"name": "item.id",
24+
"in": "path",
25+
"required": true,
26+
"type": "string"
27+
}
28+
]
29+
}
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)