[java-client][resteasy][jersey2][google-api-client][okhttp-json] several fixes to make sent requests more accurate (#3703)

This commit is contained in:
Jérémie Bresson
2019-08-22 09:50:47 +02:00
committed by GitHub
parent f6ead7b877
commit 870bb1c858
40 changed files with 168 additions and 141 deletions

View File

@@ -688,7 +688,7 @@ public class ApiClient {
}
}
Entity<?> entity = serialize(body, formParams, contentType);
Entity<?> entity = (body == null) ? Entity.json("") : serialize(body, formParams, contentType);
Response response = null;
@@ -700,7 +700,7 @@ public class ApiClient {
} else if ("PUT".equals(method)) {
response = invocationBuilder.put(entity);
} else if ("DELETE".equals(method)) {
response = invocationBuilder.delete();
response = invocationBuilder.method("DELETE", entity);
} else if ("PATCH".equals(method)) {
response = invocationBuilder.method("PATCH", entity);
} else if ("HEAD".equals(method)) {
@@ -760,8 +760,13 @@ public class ApiClient {
clientConfig.register(json);
clientConfig.register(JacksonFeature.class);
clientConfig.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);
// turn off compliance validation to be able to send payloads with DELETE calls
clientConfig.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
if (debugging) {
clientConfig.register(new LoggingFilter(java.util.logging.Logger.getLogger(LoggingFilter.class.getName()), true));
} else {
// suppress warnings for payloads with DELETE calls:
java.util.logging.Logger.getLogger("org.glassfish.jersey.client").setLevel(java.util.logging.Level.SEVERE);
}
performAdditionalClientConfiguration(clientConfig);
return ClientBuilder.newClient(clientConfig);

View File

@@ -584,7 +584,7 @@ public class FakeApi {
</table>
*/
public ApiResponse<Void> testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'number' is set
if (number == null) {
@@ -705,7 +705,7 @@ if (paramCallback != null)
</table>
*/
public ApiResponse<Void> testEnumParametersWithHttpInfo(List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List<String> enumFormStringArray, String enumFormString) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/fake";
@@ -784,7 +784,7 @@ if (enumFormString != null)
</table>
*/
public ApiResponse<Void> testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'requiredStringGroup' is set
if (requiredStringGroup == null) {
@@ -928,7 +928,7 @@ if (booleanGroup != null)
</table>
*/
public ApiResponse<Void> testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'param' is set
if (param == null) {
@@ -1007,7 +1007,7 @@ if (param2 != null)
</table>
*/
public ApiResponse<Void> testQueryParameterCollectionFormatWithHttpInfo(List<String> pipe, List<String> ioutil, List<String> http, List<String> url, List<String> context) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'pipe' is set
if (pipe == null) {

View File

@@ -134,7 +134,7 @@ public class PetApi {
</table>
*/
public ApiResponse<Void> deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
@@ -201,7 +201,7 @@ public class PetApi {
</table>
*/
public ApiResponse<List<Pet>> findPetsByStatusWithHttpInfo(List<String> status) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'status' is set
if (status == null) {
@@ -270,7 +270,7 @@ public class PetApi {
*/
@Deprecated
public ApiResponse<List<Pet>> findPetsByTagsWithHttpInfo(List<String> tags) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'tags' is set
if (tags == null) {
@@ -337,7 +337,7 @@ public class PetApi {
</table>
*/
public ApiResponse<Pet> getPetByIdWithHttpInfo(Long petId) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
@@ -472,7 +472,7 @@ public class PetApi {
</table>
*/
public ApiResponse<Void> updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
@@ -543,7 +543,7 @@ if (status != null)
</table>
*/
public ApiResponse<ModelApiResponse> uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
@@ -614,7 +614,7 @@ if (file != null)
</table>
*/
public ApiResponse<ModelApiResponse> uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {

View File

@@ -66,7 +66,7 @@ public class StoreApi {
</table>
*/
public ApiResponse<Void> deleteOrderWithHttpInfo(String orderId) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
@@ -127,7 +127,7 @@ public class StoreApi {
</table>
*/
public ApiResponse<Map<String, Integer>> getInventoryWithHttpInfo() throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/store/inventory";
@@ -188,7 +188,7 @@ public class StoreApi {
</table>
*/
public ApiResponse<Order> getOrderByIdWithHttpInfo(Long orderId) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {

View File

@@ -252,7 +252,7 @@ public class UserApi {
</table>
*/
public ApiResponse<Void> deleteUserWithHttpInfo(String username) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'username' is set
if (username == null) {
@@ -319,7 +319,7 @@ public class UserApi {
</table>
*/
public ApiResponse<User> getUserByNameWithHttpInfo(String username) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'username' is set
if (username == null) {
@@ -386,7 +386,7 @@ public class UserApi {
</table>
*/
public ApiResponse<String> loginUserWithHttpInfo(String username, String password) throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// verify the required parameter 'username' is set
if (username == null) {
@@ -453,7 +453,7 @@ public class UserApi {
</table>
*/
public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException {
Object localVarPostBody = new Object();
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/user/logout";