Skip to content

Commit 3b9cb14

Browse files
authored
[fix] Fix delete http verb (the k6 equivalent is del) (#6624)
1 parent f373f20 commit 3b9cb14

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/K6ClientCodegen.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ static class HTTPRequest {
143143

144144
public HTTPRequest(String method, String path, @Nullable List<Parameter> query, @Nullable HTTPBody body,
145145
@Nullable HTTPParameters params, @Nullable List<k6Check> k6Checks) {
146-
this.method = method;
146+
// NOTE: https://k6.io/docs/javascript-api/k6-http/del-url-body-params
147+
this.method = method.equals("delete") ? "del" : method;
147148
this.path = path;
148149
this.query = query;
149150
this.body = body;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.3.0-SNAPSHOT
1+
5.0.0-SNAPSHOT

samples/client/petstore/k6/script.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
22
* OpenAPI Petstore
3-
* This is a sample server Petstore server. For this sample, you can use the api key \"special-key\" to test the authorization filters
3+
* This is a sample server Petstore server. For this sample, you can use the api key \"special-key\" to test the authorization filters
44
*
55
* OpenAPI spec version: 1.0.0
66
*
77
* NOTE: This class is auto generated by OpenAPI Generator.
88
* https://github.com/OpenAPITools/openapi-generator
99
*
10-
* OpenAPI generator version: 4.3.0-SNAPSHOT
10+
* OpenAPI generator version: 5.0.0-SNAPSHOT
1111
*/
1212

1313

@@ -77,7 +77,7 @@ export default function() {
7777

7878
// Request No. 3
7979
params = {headers: {"api_key": `${apiKey}`}};
80-
request = http.delete(url, params);
80+
request = http.del(url, params);
8181
sleep(SLEEP_DURATION);
8282
});
8383
group("/pet/{petId}/uploadImage", () => {
@@ -125,7 +125,7 @@ export default function() {
125125
sleep(SLEEP_DURATION);
126126

127127
// Request No. 2
128-
request = http.delete(url);
128+
request = http.del(url);
129129
sleep(SLEEP_DURATION);
130130
});
131131
group("/user", () => {
@@ -198,7 +198,7 @@ export default function() {
198198
sleep(SLEEP_DURATION);
199199

200200
// Request No. 3
201-
request = http.delete(url);
201+
request = http.del(url);
202202
sleep(SLEEP_DURATION);
203203
});
204204
}

0 commit comments

Comments
 (0)