diff --git a/samples/client/petstore/k6/script.js b/samples/client/petstore/k6/script.js index 74c9e49dee1..e17a17b3bf7 100644 --- a/samples/client/petstore/k6/script.js +++ b/samples/client/petstore/k6/script.js @@ -54,7 +54,42 @@ export default function() { sleep(SLEEP_DURATION); } - // Request No. 2: testClientModel + // Request No. 2: testEndpointParameters + { + let url = BASE_URL + `/fake`; + // TODO: edit the parameters of the request body. + let body = {"integer": "integer", "int32": "integer", "int64": "long", "number": "bigdecimal", "float": "float", "double": "double", "string": "string", "patternWithoutDelimiter": "string", "byte": "byte[]", "binary": http.file(open("/path/to/file.bin", "b"), "test.bin"), "date": "date", "dateTime": "date", "password": "string", "callback": "string"}; + let params = { + headers: { + "Content-Type": "application/x-www-form-urlencoded", "global_api_key_header": `${globalApiKeyHeader}`, "Accept": "application/json" + }, cookies: { + "global_api_key_cookie": `${globalApiKeyCookie}` + } + }; + let request = http.post(url, JSON.stringify(body), params); + + + sleep(SLEEP_DURATION); + } + + // Request No. 3: testGroupParameters + { + let url = BASE_URL + `/fake?required_string_group=${required_string_group}&required_int64_group=${required_int64_group}&string_group=${string_group}&int64_group=${int64_group}`; + let params = { + headers: { + "required_boolean_group": `${requiredBooleanGroup}`, "boolean_group": `${booleanGroup}`, "global_api_key_header": `${globalApiKeyHeader}`, "Accept": "application/json" + }, cookies: { + "global_api_key_cookie": `${globalApiKeyCookie}` + } + }; + // this is a DELETE method request - if params are also set, empty body must be passed + let request = http.del(url, {} , params); + + + sleep(SLEEP_DURATION); + } + + // Request No. 4: testClientModel { let url = BASE_URL + `/fake`; // TODO: edit the parameters of the request body. @@ -203,7 +238,25 @@ export default function() { sleep(SLEEP_DURATION); } - // Request No. 2: deleteUser + // Request No. 2: updateUser + { + let url = BASE_URL + `/user/${username}`; + // TODO: edit the parameters of the request body. + let body = {"id": "long", "username": "string", "firstName": "string", "lastName": "string", "email": "string", "password": "string", "phone": "string", "userStatus": "integer"}; + let params = { + headers: { + "Content-Type": "application/json", "global_api_key_header": `${globalApiKeyHeader}`, "Accept": "application/json" + }, cookies: { + "global_api_key_cookie": `${globalApiKeyCookie}` + } + }; + let request = http.put(url, JSON.stringify(body), params); + + + sleep(SLEEP_DURATION); + } + + // Request No. 3: deleteUser { let url = BASE_URL + `/user/${username}`; let params = { @@ -474,7 +527,28 @@ export default function() { sleep(SLEEP_DURATION); } - // Request No. 2: deletePet + // Request No. 2: updatePetWithForm + { + let url = BASE_URL + `/pet/${petId}`; + // TODO: edit the parameters of the request body. + let body = {"name": "string", "status": "string"}; + let params = { + headers: { + "Content-Type": "application/x-www-form-urlencoded", "global_api_key_header": `${globalApiKeyHeader}`, "Accept": "application/json" + }, cookies: { + "global_api_key_cookie": `${globalApiKeyCookie}` + } + }; + let request = http.post(url, JSON.stringify(body), params); + + check(request, { + "Successful operation": (r) => r.status === 200 + }); + + sleep(SLEEP_DURATION); + } + + // Request No. 3: deletePet { let url = BASE_URL + `/pet/${petId}`; let params = {