diff --git a/modules/openapi-generator/src/main/resources/java-wiremock/wiremock.mustache b/modules/openapi-generator/src/main/resources/java-wiremock/wiremock.mustache index f411c6e437d8..f470d1cb3087 100644 --- a/modules/openapi-generator/src/main/resources/java-wiremock/wiremock.mustache +++ b/modules/openapi-generator/src/main/resources/java-wiremock/wiremock.mustache @@ -18,9 +18,9 @@ public class {{classname}}MockServer { @Deprecated {{/isDeprecated}} public static MappingBuilder stub{{#lambda.pascalcase}}{{operationId}}{{/lambda.pascalcase}}{{{code}}}({{#allParams}}{{#required}}{{#isNullable}}@{{javaxPackage}}.annotation.Nullable {{/isNullable}}{{^isNullable}}@{{javaxPackage}}.annotation.Nonnull {{/isNullable}}{{/required}}{{^required}}@{{javaxPackage}}.annotation.Nullable {{/required}}{{^isBodyParam}}String {{paramName}}{{/isBodyParam}}{{#isBodyParam}}String body{{/isBodyParam}}{{^-last}}, {{/-last}}{{#-last}}{{#headers.0}}, {{/headers.0}}{{^headers.0}}{{#returnType}}, {{/returnType}}{{/headers.0}}{{/-last}}{{/allParams}}{{#headers}}String response{{#lambda.pascalcase}}{{baseName}}{{/lambda.pascalcase}}{{^-last}}, {{/-last}}{{#-last}}{{#returnType}}, {{/returnType}}{{/-last}}{{/headers}}{{#returnType}}String response{{/returnType}}) { - MappingBuilder stub = {{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}({{^pathParams.0}}urlPathEqualTo{{/pathParams.0}}{{#pathParams.0}}urlPathTemplate{{/pathParams.0}}("{{{path}}}")){{#hasProduces}} - .withHeader("Accept", havingExactly({{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}})){{/hasProduces}}{{#hasAuthMethods}}{{#hasConsumes}} - .withHeader("Content-Type", havingExactly("{{#consumes.0}}{{{mediaType}}}{{/consumes.0}}")){{/hasConsumes}} + MappingBuilder stub = {{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}({{^pathParams.0}}urlPathEqualTo{{/pathParams.0}}{{#pathParams.0}}urlPathTemplate{{/pathParams.0}}("{{{path}}}")){{#hasProduces}}{{#produces}} + .withHeader("Accept", containing("{{{mediaType}}}")){{/produces}}{{/hasProduces}}{{#hasAuthMethods}}{{#hasConsumes}} + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("{{#consumes.0}}{{{mediaType}}}{{/consumes.0}}"))){{/hasConsumes}} .withHeader("Authorization", matching(".*")){{/hasAuthMethods}}{{#cookieParams}} .withCookie("{{baseName}}", havingExactly({{paramName}})){{/cookieParams}}{{#hasBodyParam}} .withRequestBody(equalToJson(body)){{/hasBodyParam}} @@ -105,9 +105,9 @@ public class {{classname}}MockServer { {{/responses}} public static MappingBuilder stub{{#lambda.pascalcase}}{{operationId}}{{/lambda.pascalcase}}Fault({{#allParams}}{{#required}}{{#isNullable}}@{{javaxPackage}}.annotation.Nullable {{/isNullable}}{{^isNullable}}@{{javaxPackage}}.annotation.Nonnull {{/isNullable}}{{/required}}{{^required}}@{{javaxPackage}}.annotation.Nullable {{/required}}{{^isBodyParam}}String {{paramName}}{{/isBodyParam}}{{#isBodyParam}}String body{{/isBodyParam}}, {{/allParams}}Fault fault) { - MappingBuilder stub = {{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}({{^pathParams.0}}urlPathEqualTo{{/pathParams.0}}{{#pathParams.0}}urlPathTemplate{{/pathParams.0}}("{{{path}}}")){{#hasProduces}} - .withHeader("Accept", havingExactly({{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}})){{/hasProduces}}{{#hasAuthMethods}}{{#hasConsumes}} - .withHeader("Content-Type", havingExactly("{{#consumes.0}}{{{mediaType}}}{{/consumes.0}}")){{/hasConsumes}} + MappingBuilder stub = {{#lambda.lowercase}}{{httpMethod}}{{/lambda.lowercase}}({{^pathParams.0}}urlPathEqualTo{{/pathParams.0}}{{#pathParams.0}}urlPathTemplate{{/pathParams.0}}("{{{path}}}")){{#hasProduces}}{{#produces}} + .withHeader("Accept", containing("{{{mediaType}}}")){{/produces}}{{/hasProduces}}{{#hasAuthMethods}}{{#hasConsumes}} + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("{{#consumes.0}}{{{mediaType}}}{{/consumes.0}}"))){{/hasConsumes}} .withHeader("Authorization", matching(".*")){{/hasAuthMethods}}{{#cookieParams}} .withCookie("{{baseName}}", havingExactly({{paramName}})){{/cookieParams}}{{#bodyParam}} .withRequestBody(equalToJson(body)){{/bodyParam}} diff --git a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/AnotherFakeApiMockServer.java b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/AnotherFakeApiMockServer.java index 5281bdaf68d2..3eab963206c1 100644 --- a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/AnotherFakeApiMockServer.java +++ b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/AnotherFakeApiMockServer.java @@ -13,7 +13,7 @@ public class AnotherFakeApiMockServer { public static MappingBuilder stubCall123testSpecialTags200(@javax.annotation.Nonnull String body, String response) { MappingBuilder stub = patch(urlPathEqualTo("/another-fake/dummy")) - .withHeader("Accept", havingExactly("application/json")) + .withHeader("Accept", containing("application/json")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withStatus(200) @@ -27,7 +27,7 @@ public static MappingBuilder stubCall123testSpecialTags200(@javax.annotation.Non public static MappingBuilder stubCall123testSpecialTagsFault(@javax.annotation.Nonnull String body, Fault fault) { MappingBuilder stub = patch(urlPathEqualTo("/another-fake/dummy")) - .withHeader("Accept", havingExactly("application/json")) + .withHeader("Accept", containing("application/json")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withFault(fault) diff --git a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/DefaultApiMockServer.java b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/DefaultApiMockServer.java index f0f8ffbc9824..c3c2d6e572e4 100644 --- a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/DefaultApiMockServer.java +++ b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/DefaultApiMockServer.java @@ -13,7 +13,7 @@ public class DefaultApiMockServer { public static MappingBuilder stubFooGet0(String response) { MappingBuilder stub = get(urlPathEqualTo("/foo")) - .withHeader("Accept", havingExactly("application/json")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withStatus(0) .withHeader("Content-Type", "application/json") @@ -26,7 +26,7 @@ public static MappingBuilder stubFooGet0(String response) { public static MappingBuilder stubFooGetFault(Fault fault) { MappingBuilder stub = get(urlPathEqualTo("/foo")) - .withHeader("Accept", havingExactly("application/json")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withFault(fault) ); diff --git a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/FakeApiMockServer.java b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/FakeApiMockServer.java index 00da87052037..e91b1b360cbf 100644 --- a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/FakeApiMockServer.java +++ b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/FakeApiMockServer.java @@ -13,7 +13,7 @@ public class FakeApiMockServer { public static MappingBuilder stubFakeBigDecimalMap200(String response) { MappingBuilder stub = get(urlPathEqualTo("/fake/BigDecimalMap")) - .withHeader("Accept", havingExactly("*/*")) + .withHeader("Accept", containing("*/*")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "*/*") @@ -26,7 +26,7 @@ public static MappingBuilder stubFakeBigDecimalMap200(String response) { public static MappingBuilder stubFakeBigDecimalMapFault(Fault fault) { MappingBuilder stub = get(urlPathEqualTo("/fake/BigDecimalMap")) - .withHeader("Accept", havingExactly("*/*")) + .withHeader("Accept", containing("*/*")) .willReturn(aResponse() .withFault(fault) ); @@ -43,7 +43,7 @@ public static String fakeBigDecimalMap200ResponseSample1() { public static MappingBuilder stubFakeHealthGet200(String response) { MappingBuilder stub = get(urlPathEqualTo("/fake/health")) - .withHeader("Accept", havingExactly("application/json")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") @@ -56,7 +56,7 @@ public static MappingBuilder stubFakeHealthGet200(String response) { public static MappingBuilder stubFakeHealthGetFault(Fault fault) { MappingBuilder stub = get(urlPathEqualTo("/fake/health")) - .withHeader("Accept", havingExactly("application/json")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withFault(fault) ); @@ -73,7 +73,7 @@ public static String fakeHealthGet200ResponseSample1() { public static MappingBuilder stubFakeHttpSignatureTest200(@javax.annotation.Nonnull String body, @javax.annotation.Nullable String query1, @javax.annotation.Nullable String header1) { MappingBuilder stub = get(urlPathEqualTo("/fake/http-signature-test")) - .withHeader("Content-Type", havingExactly("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/json"))) .withHeader("Authorization", matching(".*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() @@ -92,7 +92,7 @@ public static MappingBuilder stubFakeHttpSignatureTest200(@javax.annotation.Nonn public static MappingBuilder stubFakeHttpSignatureTestFault(@javax.annotation.Nonnull String body, @javax.annotation.Nullable String query1, @javax.annotation.Nullable String header1, Fault fault) { MappingBuilder stub = get(urlPathEqualTo("/fake/http-signature-test")) - .withHeader("Content-Type", havingExactly("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/json"))) .withHeader("Authorization", matching(".*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() @@ -120,7 +120,7 @@ public static String fakeHttpSignatureTestRequestSample2() { public static MappingBuilder stubFakeOuterBooleanSerialize200(@javax.annotation.Nullable String body, String response) { MappingBuilder stub = post(urlPathEqualTo("/fake/outer/boolean")) - .withHeader("Accept", havingExactly("*/*")) + .withHeader("Accept", containing("*/*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withStatus(200) @@ -134,7 +134,7 @@ public static MappingBuilder stubFakeOuterBooleanSerialize200(@javax.annotation. public static MappingBuilder stubFakeOuterBooleanSerializeFault(@javax.annotation.Nullable String body, Fault fault) { MappingBuilder stub = post(urlPathEqualTo("/fake/outer/boolean")) - .withHeader("Accept", havingExactly("*/*")) + .withHeader("Accept", containing("*/*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withFault(fault) @@ -152,7 +152,7 @@ public static String fakeOuterBooleanSerializeRequestSample1() { public static MappingBuilder stubFakeOuterCompositeSerialize200(@javax.annotation.Nullable String body, String response) { MappingBuilder stub = post(urlPathEqualTo("/fake/outer/composite")) - .withHeader("Accept", havingExactly("*/*")) + .withHeader("Accept", containing("*/*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withStatus(200) @@ -166,7 +166,7 @@ public static MappingBuilder stubFakeOuterCompositeSerialize200(@javax.annotatio public static MappingBuilder stubFakeOuterCompositeSerializeFault(@javax.annotation.Nullable String body, Fault fault) { MappingBuilder stub = post(urlPathEqualTo("/fake/outer/composite")) - .withHeader("Accept", havingExactly("*/*")) + .withHeader("Accept", containing("*/*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withFault(fault) @@ -187,7 +187,7 @@ public static String fakeOuterCompositeSerializeRequestSample1() { public static MappingBuilder stubFakeOuterNumberSerialize200(@javax.annotation.Nullable String body, String response) { MappingBuilder stub = post(urlPathEqualTo("/fake/outer/number")) - .withHeader("Accept", havingExactly("*/*")) + .withHeader("Accept", containing("*/*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withStatus(200) @@ -201,7 +201,7 @@ public static MappingBuilder stubFakeOuterNumberSerialize200(@javax.annotation.N public static MappingBuilder stubFakeOuterNumberSerializeFault(@javax.annotation.Nullable String body, Fault fault) { MappingBuilder stub = post(urlPathEqualTo("/fake/outer/number")) - .withHeader("Accept", havingExactly("*/*")) + .withHeader("Accept", containing("*/*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withFault(fault) @@ -219,7 +219,7 @@ public static String fakeOuterNumberSerializeRequestSample1() { public static MappingBuilder stubFakeOuterStringSerialize200(@javax.annotation.Nullable String body, String response) { MappingBuilder stub = post(urlPathEqualTo("/fake/outer/string")) - .withHeader("Accept", havingExactly("*/*")) + .withHeader("Accept", containing("*/*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withStatus(200) @@ -233,7 +233,7 @@ public static MappingBuilder stubFakeOuterStringSerialize200(@javax.annotation.N public static MappingBuilder stubFakeOuterStringSerializeFault(@javax.annotation.Nullable String body, Fault fault) { MappingBuilder stub = post(urlPathEqualTo("/fake/outer/string")) - .withHeader("Accept", havingExactly("*/*")) + .withHeader("Accept", containing("*/*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withFault(fault) @@ -251,7 +251,7 @@ public static String fakeOuterStringSerializeRequestSample1() { public static MappingBuilder stubFakePropertyEnumIntegerSerialize200(@javax.annotation.Nonnull String body, String response) { MappingBuilder stub = post(urlPathEqualTo("/fake/property/enum-int")) - .withHeader("Accept", havingExactly("*/*")) + .withHeader("Accept", containing("*/*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withStatus(200) @@ -265,7 +265,7 @@ public static MappingBuilder stubFakePropertyEnumIntegerSerialize200(@javax.anno public static MappingBuilder stubFakePropertyEnumIntegerSerializeFault(@javax.annotation.Nonnull String body, Fault fault) { MappingBuilder stub = post(urlPathEqualTo("/fake/property/enum-int")) - .withHeader("Accept", havingExactly("*/*")) + .withHeader("Accept", containing("*/*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withFault(fault) @@ -400,7 +400,7 @@ public static String testBodyWithQueryParamsRequestSample1() { public static MappingBuilder stubTestClientModel200(@javax.annotation.Nonnull String body, String response) { MappingBuilder stub = patch(urlPathEqualTo("/fake")) - .withHeader("Accept", havingExactly("application/json")) + .withHeader("Accept", containing("application/json")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withStatus(200) @@ -414,7 +414,7 @@ public static MappingBuilder stubTestClientModel200(@javax.annotation.Nonnull St public static MappingBuilder stubTestClientModelFault(@javax.annotation.Nonnull String body, Fault fault) { MappingBuilder stub = patch(urlPathEqualTo("/fake")) - .withHeader("Accept", havingExactly("application/json")) + .withHeader("Accept", containing("application/json")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withFault(fault) @@ -435,7 +435,7 @@ public static String testClientModelRequestSample1() { public static MappingBuilder stubTestEndpointParameters400(@javax.annotation.Nonnull String number, @javax.annotation.Nonnull String _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull String _byte, @javax.annotation.Nullable String integer, @javax.annotation.Nullable String int32, @javax.annotation.Nullable String int64, @javax.annotation.Nullable String _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable String binary, @javax.annotation.Nullable String date, @javax.annotation.Nullable String dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) { MappingBuilder stub = post(urlPathEqualTo("/fake")) - .withHeader("Content-Type", havingExactly("application/x-www-form-urlencoded")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/x-www-form-urlencoded"))) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(400) @@ -481,7 +481,7 @@ public static MappingBuilder stubTestEndpointParameters400(@javax.annotation.Non public static MappingBuilder stubTestEndpointParameters404(@javax.annotation.Nonnull String number, @javax.annotation.Nonnull String _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull String _byte, @javax.annotation.Nullable String integer, @javax.annotation.Nullable String int32, @javax.annotation.Nullable String int64, @javax.annotation.Nullable String _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable String binary, @javax.annotation.Nullable String date, @javax.annotation.Nullable String dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback) { MappingBuilder stub = post(urlPathEqualTo("/fake")) - .withHeader("Content-Type", havingExactly("application/x-www-form-urlencoded")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/x-www-form-urlencoded"))) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(404) @@ -527,7 +527,7 @@ public static MappingBuilder stubTestEndpointParameters404(@javax.annotation.Non public static MappingBuilder stubTestEndpointParametersFault(@javax.annotation.Nonnull String number, @javax.annotation.Nonnull String _double, @javax.annotation.Nonnull String patternWithoutDelimiter, @javax.annotation.Nonnull String _byte, @javax.annotation.Nullable String integer, @javax.annotation.Nullable String int32, @javax.annotation.Nullable String int64, @javax.annotation.Nullable String _float, @javax.annotation.Nullable String string, @javax.annotation.Nullable String binary, @javax.annotation.Nullable String date, @javax.annotation.Nullable String dateTime, @javax.annotation.Nullable String password, @javax.annotation.Nullable String paramCallback, Fault fault) { MappingBuilder stub = post(urlPathEqualTo("/fake")) - .withHeader("Content-Type", havingExactly("application/x-www-form-urlencoded")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/x-www-form-urlencoded"))) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withFault(fault) diff --git a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/FakeClassnameTags123ApiMockServer.java b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/FakeClassnameTags123ApiMockServer.java index a2616cf70d7b..cdd63d5755f3 100644 --- a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/FakeClassnameTags123ApiMockServer.java +++ b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/FakeClassnameTags123ApiMockServer.java @@ -13,8 +13,8 @@ public class FakeClassnameTags123ApiMockServer { public static MappingBuilder stubTestClassname200(@javax.annotation.Nonnull String body, String response) { MappingBuilder stub = patch(urlPathEqualTo("/fake_classname_test")) - .withHeader("Accept", havingExactly("application/json")) - .withHeader("Content-Type", havingExactly("application/json")) + .withHeader("Accept", containing("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/json"))) .withHeader("Authorization", matching(".*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() @@ -29,8 +29,8 @@ public static MappingBuilder stubTestClassname200(@javax.annotation.Nonnull Stri public static MappingBuilder stubTestClassnameFault(@javax.annotation.Nonnull String body, Fault fault) { MappingBuilder stub = patch(urlPathEqualTo("/fake_classname_test")) - .withHeader("Accept", havingExactly("application/json")) - .withHeader("Content-Type", havingExactly("application/json")) + .withHeader("Accept", containing("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/json"))) .withHeader("Authorization", matching(".*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() diff --git a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/PetApiMockServer.java b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/PetApiMockServer.java index 2f7f302790f8..1c50edbde009 100644 --- a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/PetApiMockServer.java +++ b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/PetApiMockServer.java @@ -13,7 +13,7 @@ public class PetApiMockServer { public static MappingBuilder stubAddPet200(@javax.annotation.Nonnull String body) { MappingBuilder stub = post(urlPathEqualTo("/pet")) - .withHeader("Content-Type", havingExactly("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/json"))) .withHeader("Authorization", matching(".*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() @@ -26,7 +26,7 @@ public static MappingBuilder stubAddPet200(@javax.annotation.Nonnull String body public static MappingBuilder stubAddPet405(@javax.annotation.Nonnull String body) { MappingBuilder stub = post(urlPathEqualTo("/pet")) - .withHeader("Content-Type", havingExactly("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/json"))) .withHeader("Authorization", matching(".*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() @@ -39,7 +39,7 @@ public static MappingBuilder stubAddPet405(@javax.annotation.Nonnull String body public static MappingBuilder stubAddPetFault(@javax.annotation.Nonnull String body, Fault fault) { MappingBuilder stub = post(urlPathEqualTo("/pet")) - .withHeader("Content-Type", havingExactly("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/json"))) .withHeader("Authorization", matching(".*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() @@ -109,7 +109,8 @@ public static MappingBuilder stubDeletePetFault(@javax.annotation.Nonnull String public static MappingBuilder stubFindPetsByStatus200(@javax.annotation.Nonnull String status, String response) { MappingBuilder stub = get(urlPathEqualTo("/pet/findByStatus")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(200) @@ -124,7 +125,8 @@ public static MappingBuilder stubFindPetsByStatus200(@javax.annotation.Nonnull S public static MappingBuilder stubFindPetsByStatus400(@javax.annotation.Nonnull String status, String response) { MappingBuilder stub = get(urlPathEqualTo("/pet/findByStatus")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(400) @@ -139,7 +141,8 @@ public static MappingBuilder stubFindPetsByStatus400(@javax.annotation.Nonnull S public static MappingBuilder stubFindPetsByStatusFault(@javax.annotation.Nonnull String status, Fault fault) { MappingBuilder stub = get(urlPathEqualTo("/pet/findByStatus")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withFault(fault) @@ -162,7 +165,8 @@ public static String findPetsByStatus200ResponseSample2() { @Deprecated public static MappingBuilder stubFindPetsByTags200(@javax.annotation.Nonnull String tags, String response) { MappingBuilder stub = get(urlPathEqualTo("/pet/findByTags")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(200) @@ -178,7 +182,8 @@ public static MappingBuilder stubFindPetsByTags200(@javax.annotation.Nonnull Str @Deprecated public static MappingBuilder stubFindPetsByTags400(@javax.annotation.Nonnull String tags, String response) { MappingBuilder stub = get(urlPathEqualTo("/pet/findByTags")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(400) @@ -193,7 +198,8 @@ public static MappingBuilder stubFindPetsByTags400(@javax.annotation.Nonnull Str public static MappingBuilder stubFindPetsByTagsFault(@javax.annotation.Nonnull String tags, Fault fault) { MappingBuilder stub = get(urlPathEqualTo("/pet/findByTags")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withFault(fault) @@ -215,7 +221,8 @@ public static String findPetsByTags200ResponseSample2() { public static MappingBuilder stubGetPetById200(@javax.annotation.Nonnull String petId, String response) { MappingBuilder stub = get(urlPathTemplate("/pet/{petId}")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(200) @@ -230,7 +237,8 @@ public static MappingBuilder stubGetPetById200(@javax.annotation.Nonnull String public static MappingBuilder stubGetPetById400(@javax.annotation.Nonnull String petId, String response) { MappingBuilder stub = get(urlPathTemplate("/pet/{petId}")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(400) @@ -245,7 +253,8 @@ public static MappingBuilder stubGetPetById400(@javax.annotation.Nonnull String public static MappingBuilder stubGetPetById404(@javax.annotation.Nonnull String petId, String response) { MappingBuilder stub = get(urlPathTemplate("/pet/{petId}")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(404) @@ -260,7 +269,8 @@ public static MappingBuilder stubGetPetById404(@javax.annotation.Nonnull String public static MappingBuilder stubGetPetByIdFault(@javax.annotation.Nonnull String petId, Fault fault) { MappingBuilder stub = get(urlPathTemplate("/pet/{petId}")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withFault(fault) @@ -282,7 +292,7 @@ public static String getPetById200ResponseSample2() { public static MappingBuilder stubUpdatePet200(@javax.annotation.Nonnull String body) { MappingBuilder stub = put(urlPathEqualTo("/pet")) - .withHeader("Content-Type", havingExactly("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/json"))) .withHeader("Authorization", matching(".*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() @@ -295,7 +305,7 @@ public static MappingBuilder stubUpdatePet200(@javax.annotation.Nonnull String b public static MappingBuilder stubUpdatePet400(@javax.annotation.Nonnull String body) { MappingBuilder stub = put(urlPathEqualTo("/pet")) - .withHeader("Content-Type", havingExactly("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/json"))) .withHeader("Authorization", matching(".*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() @@ -308,7 +318,7 @@ public static MappingBuilder stubUpdatePet400(@javax.annotation.Nonnull String b public static MappingBuilder stubUpdatePet404(@javax.annotation.Nonnull String body) { MappingBuilder stub = put(urlPathEqualTo("/pet")) - .withHeader("Content-Type", havingExactly("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/json"))) .withHeader("Authorization", matching(".*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() @@ -321,7 +331,7 @@ public static MappingBuilder stubUpdatePet404(@javax.annotation.Nonnull String b public static MappingBuilder stubUpdatePet405(@javax.annotation.Nonnull String body) { MappingBuilder stub = put(urlPathEqualTo("/pet")) - .withHeader("Content-Type", havingExactly("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/json"))) .withHeader("Authorization", matching(".*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() @@ -334,7 +344,7 @@ public static MappingBuilder stubUpdatePet405(@javax.annotation.Nonnull String b public static MappingBuilder stubUpdatePetFault(@javax.annotation.Nonnull String body, Fault fault) { MappingBuilder stub = put(urlPathEqualTo("/pet")) - .withHeader("Content-Type", havingExactly("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/json"))) .withHeader("Authorization", matching(".*")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() @@ -356,7 +366,7 @@ public static String updatePetRequestSample2() { public static MappingBuilder stubUpdatePetWithForm200(@javax.annotation.Nonnull String petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) { MappingBuilder stub = post(urlPathTemplate("/pet/{petId}")) - .withHeader("Content-Type", havingExactly("application/x-www-form-urlencoded")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/x-www-form-urlencoded"))) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(200) @@ -375,7 +385,7 @@ public static MappingBuilder stubUpdatePetWithForm200(@javax.annotation.Nonnull public static MappingBuilder stubUpdatePetWithForm405(@javax.annotation.Nonnull String petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status) { MappingBuilder stub = post(urlPathTemplate("/pet/{petId}")) - .withHeader("Content-Type", havingExactly("application/x-www-form-urlencoded")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/x-www-form-urlencoded"))) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(405) @@ -394,7 +404,7 @@ public static MappingBuilder stubUpdatePetWithForm405(@javax.annotation.Nonnull public static MappingBuilder stubUpdatePetWithFormFault(@javax.annotation.Nonnull String petId, @javax.annotation.Nullable String name, @javax.annotation.Nullable String status, Fault fault) { MappingBuilder stub = post(urlPathTemplate("/pet/{petId}")) - .withHeader("Content-Type", havingExactly("application/x-www-form-urlencoded")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("application/x-www-form-urlencoded"))) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withFault(fault) @@ -416,8 +426,8 @@ public static MappingBuilder stubUpdatePetWithFormFault(@javax.annotation.Nonnul public static MappingBuilder stubUploadFile200(@javax.annotation.Nonnull String petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable String _file, String response) { MappingBuilder stub = post(urlPathTemplate("/pet/{petId}/uploadImage")) - .withHeader("Accept", havingExactly("application/json")) - .withHeader("Content-Type", havingExactly("multipart/form-data")) + .withHeader("Accept", containing("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("multipart/form-data"))) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(200) @@ -438,8 +448,8 @@ public static MappingBuilder stubUploadFile200(@javax.annotation.Nonnull String public static MappingBuilder stubUploadFileFault(@javax.annotation.Nonnull String petId, @javax.annotation.Nullable String additionalMetadata, @javax.annotation.Nullable String _file, Fault fault) { MappingBuilder stub = post(urlPathTemplate("/pet/{petId}/uploadImage")) - .withHeader("Accept", havingExactly("application/json")) - .withHeader("Content-Type", havingExactly("multipart/form-data")) + .withHeader("Accept", containing("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("multipart/form-data"))) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withFault(fault) @@ -464,8 +474,8 @@ public static String uploadFile200ResponseSample1() { public static MappingBuilder stubUploadFileWithRequiredFile200(@javax.annotation.Nonnull String petId, @javax.annotation.Nonnull String requiredFile, @javax.annotation.Nullable String additionalMetadata, String response) { MappingBuilder stub = post(urlPathTemplate("/fake/{petId}/uploadImageWithRequiredFile")) - .withHeader("Accept", havingExactly("application/json")) - .withHeader("Content-Type", havingExactly("multipart/form-data")) + .withHeader("Accept", containing("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("multipart/form-data"))) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(200) @@ -484,8 +494,8 @@ public static MappingBuilder stubUploadFileWithRequiredFile200(@javax.annotation public static MappingBuilder stubUploadFileWithRequiredFileFault(@javax.annotation.Nonnull String petId, @javax.annotation.Nonnull String requiredFile, @javax.annotation.Nullable String additionalMetadata, Fault fault) { MappingBuilder stub = post(urlPathTemplate("/fake/{petId}/uploadImageWithRequiredFile")) - .withHeader("Accept", havingExactly("application/json")) - .withHeader("Content-Type", havingExactly("multipart/form-data")) + .withHeader("Accept", containing("application/json")) + .withHeader("Content-Type", havingExactly(equalToIgnoreCase("multipart/form-data"))) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withFault(fault) diff --git a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/StoreApiMockServer.java b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/StoreApiMockServer.java index f6677c0fb935..33fb0f14c700 100644 --- a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/StoreApiMockServer.java +++ b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/StoreApiMockServer.java @@ -49,7 +49,7 @@ public static MappingBuilder stubDeleteOrderFault(@javax.annotation.Nonnull Stri public static MappingBuilder stubGetInventory200(String response) { MappingBuilder stub = get(urlPathEqualTo("/store/inventory")) - .withHeader("Accept", havingExactly("application/json")) + .withHeader("Accept", containing("application/json")) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withStatus(200) @@ -63,7 +63,7 @@ public static MappingBuilder stubGetInventory200(String response) { public static MappingBuilder stubGetInventoryFault(Fault fault) { MappingBuilder stub = get(urlPathEqualTo("/store/inventory")) - .withHeader("Accept", havingExactly("application/json")) + .withHeader("Accept", containing("application/json")) .withHeader("Authorization", matching(".*")) .willReturn(aResponse() .withFault(fault) @@ -78,7 +78,8 @@ public static MappingBuilder stubGetInventoryFault(Fault fault) { public static MappingBuilder stubGetOrderById200(@javax.annotation.Nonnull String orderId, String response) { MappingBuilder stub = get(urlPathTemplate("/store/order/{order_id}")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/xml") @@ -92,7 +93,8 @@ public static MappingBuilder stubGetOrderById200(@javax.annotation.Nonnull Strin public static MappingBuilder stubGetOrderById400(@javax.annotation.Nonnull String orderId, String response) { MappingBuilder stub = get(urlPathTemplate("/store/order/{order_id}")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withStatus(400) .withHeader("Content-Type", "application/xml") @@ -106,7 +108,8 @@ public static MappingBuilder stubGetOrderById400(@javax.annotation.Nonnull Strin public static MappingBuilder stubGetOrderById404(@javax.annotation.Nonnull String orderId, String response) { MappingBuilder stub = get(urlPathTemplate("/store/order/{order_id}")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withStatus(404) .withHeader("Content-Type", "application/xml") @@ -120,7 +123,8 @@ public static MappingBuilder stubGetOrderById404(@javax.annotation.Nonnull Strin public static MappingBuilder stubGetOrderByIdFault(@javax.annotation.Nonnull String orderId, Fault fault) { MappingBuilder stub = get(urlPathTemplate("/store/order/{order_id}")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withFault(fault) ); @@ -141,7 +145,8 @@ public static String getOrderById200ResponseSample2() { public static MappingBuilder stubPlaceOrder200(@javax.annotation.Nonnull String body, String response) { MappingBuilder stub = post(urlPathEqualTo("/store/order")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withStatus(200) @@ -155,7 +160,8 @@ public static MappingBuilder stubPlaceOrder200(@javax.annotation.Nonnull String public static MappingBuilder stubPlaceOrder400(@javax.annotation.Nonnull String body, String response) { MappingBuilder stub = post(urlPathEqualTo("/store/order")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withStatus(400) @@ -169,7 +175,8 @@ public static MappingBuilder stubPlaceOrder400(@javax.annotation.Nonnull String public static MappingBuilder stubPlaceOrderFault(@javax.annotation.Nonnull String body, Fault fault) { MappingBuilder stub = post(urlPathEqualTo("/store/order")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .withRequestBody(equalToJson(body)) .willReturn(aResponse() .withFault(fault) diff --git a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/UserApiMockServer.java b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/UserApiMockServer.java index 7ee9f00b79f8..6dfdbfab5598 100644 --- a/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/UserApiMockServer.java +++ b/samples/server/petstore/java-wiremock/src/main/java/org/openapitools/mockserver/api/UserApiMockServer.java @@ -133,7 +133,8 @@ public static MappingBuilder stubDeleteUserFault(@javax.annotation.Nonnull Strin public static MappingBuilder stubGetUserByName200(@javax.annotation.Nonnull String username, String response) { MappingBuilder stub = get(urlPathTemplate("/user/{username}")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/xml") @@ -147,7 +148,8 @@ public static MappingBuilder stubGetUserByName200(@javax.annotation.Nonnull Stri public static MappingBuilder stubGetUserByName400(@javax.annotation.Nonnull String username, String response) { MappingBuilder stub = get(urlPathTemplate("/user/{username}")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withStatus(400) .withHeader("Content-Type", "application/xml") @@ -161,7 +163,8 @@ public static MappingBuilder stubGetUserByName400(@javax.annotation.Nonnull Stri public static MappingBuilder stubGetUserByName404(@javax.annotation.Nonnull String username, String response) { MappingBuilder stub = get(urlPathTemplate("/user/{username}")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withStatus(404) .withHeader("Content-Type", "application/xml") @@ -175,7 +178,8 @@ public static MappingBuilder stubGetUserByName404(@javax.annotation.Nonnull Stri public static MappingBuilder stubGetUserByNameFault(@javax.annotation.Nonnull String username, Fault fault) { MappingBuilder stub = get(urlPathTemplate("/user/{username}")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withFault(fault) ); @@ -196,7 +200,8 @@ public static String getUserByName200ResponseSample2() { public static MappingBuilder stubLoginUser200(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, String responseXRateLimit, String responseXExpiresAfter, String response) { MappingBuilder stub = get(urlPathEqualTo("/user/login")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/xml") @@ -213,7 +218,8 @@ public static MappingBuilder stubLoginUser200(@javax.annotation.Nonnull String u public static MappingBuilder stubLoginUser400(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, String response) { MappingBuilder stub = get(urlPathEqualTo("/user/login")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withStatus(400) .withHeader("Content-Type", "application/xml") @@ -228,7 +234,8 @@ public static MappingBuilder stubLoginUser400(@javax.annotation.Nonnull String u public static MappingBuilder stubLoginUserFault(@javax.annotation.Nonnull String username, @javax.annotation.Nonnull String password, Fault fault) { MappingBuilder stub = get(urlPathEqualTo("/user/login")) - .withHeader("Accept", havingExactly("application/xml", "application/json")) + .withHeader("Accept", containing("application/xml")) + .withHeader("Accept", containing("application/json")) .willReturn(aResponse() .withFault(fault) );