From d6e5af51fd6332dcc0055152c87e7403f744ccf3 Mon Sep 17 00:00:00 2001
From: kannkyo <15080890+kannkyo@users.noreply.github.com>
Date: Sat, 5 Dec 2020 09:38:07 +0900
Subject: [PATCH] Support mediaType
---
.../main/resources/jmeter-client/api.mustache | 10 +++++-
samples/client/petstore/jmeter/PetApi.csv | 2 +-
samples/client/petstore/jmeter/PetApi.jmx | 32 +++++++++++++++++++
samples/client/petstore/jmeter/StoreApi.csv | 2 +-
samples/client/petstore/jmeter/StoreApi.jmx | 12 +++++++
samples/client/petstore/jmeter/UserApi.csv | 2 +-
samples/client/petstore/jmeter/UserApi.jmx | 8 +++++
7 files changed, 64 insertions(+), 4 deletions(-)
diff --git a/modules/openapi-generator/src/main/resources/jmeter-client/api.mustache b/modules/openapi-generator/src/main/resources/jmeter-client/api.mustache
index d421423b0617..df7146130eee 100644
--- a/modules/openapi-generator/src/main/resources/jmeter-client/api.mustache
+++ b/modules/openapi-generator/src/main/resources/jmeter-client/api.mustache
@@ -85,7 +85,15 @@
{{paramName}}
${__RandomString(10,qwertyuiopasdfghjklzxcvbnm)}
- {{/headerParams}}
+ {{/headerParams}}{{#consumes.0}}
+
+ Content-Type
+ {{{mediaType}}}
+ {{/consumes.0}}{{#produces.0}}
+
+ accept
+ {{{mediaType}}}
+ {{/produces.0}}
diff --git a/samples/client/petstore/jmeter/PetApi.csv b/samples/client/petstore/jmeter/PetApi.csv
index 2ab795b50f75..29b09a1715de 100644
--- a/samples/client/petstore/jmeter/PetApi.csv
+++ b/samples/client/petstore/jmeter/PetApi.csv
@@ -1,2 +1,2 @@
-testCase,httpStatusCode,pet,petId,apiKey,status,tags,petId,pet,petId,name,status,petId,additionalMetadata,file
+testCase,httpStatusCode,body,petId,apiKey,status,tags,petId,body,petId,name,status,petId,additionalMetadata,file
Success,200,0,0,0,0,0,0,0,0,0,0,0,0,0
\ No newline at end of file
diff --git a/samples/client/petstore/jmeter/PetApi.jmx b/samples/client/petstore/jmeter/PetApi.jmx
index 8e36592e32c5..ed22d0526b83 100644
--- a/samples/client/petstore/jmeter/PetApi.jmx
+++ b/samples/client/petstore/jmeter/PetApi.jmx
@@ -117,6 +117,10 @@
+
+ Content-Type
+ application/json
+
@@ -253,6 +257,10 @@
+
+ accept
+ application/xml
+
@@ -326,6 +334,10 @@
+
+ accept
+ application/xml
+
@@ -399,6 +411,10 @@
+
+ accept
+ application/xml
+
@@ -465,6 +481,10 @@
+
+ Content-Type
+ application/json
+
@@ -531,6 +551,10 @@
+
+ Content-Type
+ application/x-www-form-urlencoded
+
@@ -597,6 +621,14 @@
+
+ Content-Type
+ multipart/form-data
+
+
+ accept
+ application/json
+
diff --git a/samples/client/petstore/jmeter/StoreApi.csv b/samples/client/petstore/jmeter/StoreApi.csv
index 2ccf8884aff0..70fd54e2b204 100644
--- a/samples/client/petstore/jmeter/StoreApi.csv
+++ b/samples/client/petstore/jmeter/StoreApi.csv
@@ -1,2 +1,2 @@
-testCase,httpStatusCode,orderId,orderId,order
+testCase,httpStatusCode,orderId,orderId,body
Success,200,0,0,0
\ No newline at end of file
diff --git a/samples/client/petstore/jmeter/StoreApi.jmx b/samples/client/petstore/jmeter/StoreApi.jmx
index 21eb7f3059d7..79961e719e33 100644
--- a/samples/client/petstore/jmeter/StoreApi.jmx
+++ b/samples/client/petstore/jmeter/StoreApi.jmx
@@ -163,6 +163,10 @@
+
+ accept
+ application/json
+
@@ -229,6 +233,10 @@
+
+ accept
+ application/xml
+
@@ -295,6 +303,10 @@
+
+ accept
+ application/xml
+
diff --git a/samples/client/petstore/jmeter/UserApi.csv b/samples/client/petstore/jmeter/UserApi.csv
index 66fcc84a5901..92242d4077c7 100644
--- a/samples/client/petstore/jmeter/UserApi.csv
+++ b/samples/client/petstore/jmeter/UserApi.csv
@@ -1,2 +1,2 @@
-testCase,httpStatusCode,user,user,user,username,username,username,password,username,user
+testCase,httpStatusCode,body,body,body,username,username,username,password,username,body
Success,200,0,0,0,0,0,0,0,0,0
\ No newline at end of file
diff --git a/samples/client/petstore/jmeter/UserApi.jmx b/samples/client/petstore/jmeter/UserApi.jmx
index 2dd7aee906e2..099f00cc4df4 100644
--- a/samples/client/petstore/jmeter/UserApi.jmx
+++ b/samples/client/petstore/jmeter/UserApi.jmx
@@ -381,6 +381,10 @@
+
+ accept
+ application/xml
+
@@ -447,6 +451,10 @@
+
+ accept
+ application/xml
+