|
1 | 1 | /* |
2 | 2 | * -------------------------------------------------------------------------------- |
3 | 3 | * <copyright company="Aspose" file="ApiClient.java"> |
4 | | - * Copyright (c) 2023 Aspose.Words for Cloud |
| 4 | + * Copyright (c) 2024 Aspose.Words for Cloud |
5 | 5 | * </copyright> |
6 | 6 | * <summary> |
7 | 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
@@ -59,7 +59,7 @@ public class ApiClient { |
59 | 59 | private String apiVersion = "v4.0"; |
60 | 60 | private String baseUrl = "https://api.aspose.cloud"; |
61 | 61 | private String basePath = baseUrl + "/" + apiVersion; |
62 | | - private String clientVersion = "23.12"; |
| 62 | + private String clientVersion = "24.1"; |
63 | 63 | private boolean debugging = false; |
64 | 64 | private Map<String, String> defaultHeaderMap = new HashMap<String, String>(); |
65 | 65 | private String tempFolderPath = null; |
@@ -827,7 +827,14 @@ public Request buildRequest(String path, String method, List<Pair> queryParams, |
827 | 827 | RequestBody reqBody = null; |
828 | 828 | if (HttpMethod.permitsRequestBody(method)) { |
829 | 829 | String contentType = headerParams.get("Content-Type"); |
830 | | - int partsCount = formParams.size() + filesContentParams.size(); |
| 830 | + int partsCount = formParams.size(); |
| 831 | + for (FileReference fileReference : filesContentParams) { |
| 832 | + fileReference.encryptPassword(this); |
| 833 | + if ("Request".equals(fileReference.getSource())) { |
| 834 | + partsCount = partsCount + 1; |
| 835 | + } |
| 836 | + } |
| 837 | + |
831 | 838 | if ("application/x-www-form-urlencoded".equals(contentType)) { |
832 | 839 | reqBody = buildRequestBodyFormEncoding(formParams); |
833 | 840 | } |
@@ -974,9 +981,11 @@ public RequestBody buildRequestBodyMultipart(Map<String, Object> formParams, Lis |
974 | 981 | Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); |
975 | 982 | mpBuilder.addPart(partHeaders, serialize(param.getValue())); |
976 | 983 | } |
977 | | - for (FileReference param : fileParams) { |
978 | | - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getReference() + "\""); |
979 | | - mpBuilder.addPart(partHeaders, RequestBody.create(MediaType.parse("application/octet-stream"), param.getContent())); |
| 984 | + for (FileReference fileRef : fileParams) { |
| 985 | + if ("Request".equals(fileRef.getSource())) { |
| 986 | + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + fileRef.getReference() + "\""); |
| 987 | + mpBuilder.addPart(partHeaders, RequestBody.create(MediaType.parse("application/octet-stream"), fileRef.getContent())); |
| 988 | + } |
980 | 989 | } |
981 | 990 | } |
982 | 991 | return mpBuilder.build(); |
@@ -1224,7 +1233,7 @@ public Object parseBatchPart(RequestIfc apiRequest, Request sysRequest, BodyPart |
1224 | 1233 | * Encrypt string to base64-encoded string |
1225 | 1234 | */ |
1226 | 1235 | public String encrypt(String data) throws ApiException, IOException { |
1227 | | - if (data != null && !data.isEmpty()) { |
| 1236 | + if (data == null || data.isEmpty()) { |
1228 | 1237 | return null; |
1229 | 1238 | } |
1230 | 1239 |
|
|
0 commit comments