[Java][retrofit2] Fix for Issue #7446 (#7659)

* [Java][retrofit2]  Fix for issue #7446:  file upload sets filename as baseName instead of a dynamic filename. The solution is to use  okhttp3.MultipartBody.Part instead of RequestBody in formParams template.

* Changes corresponding to review comments

* Petstore Samples

* Fixed tests
This commit is contained in:
Adrien CABARBAYE
2018-02-22 13:45:19 +00:00
committed by William Cheng
parent b4827beba4
commit d4543a99e3
73 changed files with 130 additions and 115 deletions

View File

@@ -16,7 +16,7 @@ Method | HTTP request | Description
<a name="addPet"></a>
# **addPet**
> Void addPet(body)
> addPet(body)
Add a new pet to the store
@@ -40,8 +40,7 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi();
Pet body = new Pet(); // Pet | Pet object that needs to be added to the store
try {
Void result = apiInstance.addPet(body);
System.out.println(result);
apiInstance.addPet(body);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#addPet");
e.printStackTrace();
@@ -56,7 +55,7 @@ Name | Type | Description | Notes
### Return type
[**Void**](.md)
null (empty response body)
### Authorization
@@ -69,7 +68,7 @@ Name | Type | Description | Notes
<a name="deletePet"></a>
# **deletePet**
> Void deletePet(petId, apiKey)
> deletePet(petId, apiKey)
Deletes a pet
@@ -94,8 +93,7 @@ PetApi apiInstance = new PetApi();
Long petId = 789L; // Long | Pet id to delete
String apiKey = "apiKey_example"; // String |
try {
Void result = apiInstance.deletePet(petId, apiKey);
System.out.println(result);
apiInstance.deletePet(petId, apiKey);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#deletePet");
e.printStackTrace();
@@ -111,7 +109,7 @@ Name | Type | Description | Notes
### Return type
[**Void**](.md)
null (empty response body)
### Authorization
@@ -285,7 +283,7 @@ Name | Type | Description | Notes
<a name="updatePet"></a>
# **updatePet**
> Void updatePet(body)
> updatePet(body)
Update an existing pet
@@ -309,8 +307,7 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN");
PetApi apiInstance = new PetApi();
Pet body = new Pet(); // Pet | Pet object that needs to be added to the store
try {
Void result = apiInstance.updatePet(body);
System.out.println(result);
apiInstance.updatePet(body);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#updatePet");
e.printStackTrace();
@@ -325,7 +322,7 @@ Name | Type | Description | Notes
### Return type
[**Void**](.md)
null (empty response body)
### Authorization
@@ -338,7 +335,7 @@ Name | Type | Description | Notes
<a name="updatePetWithForm"></a>
# **updatePetWithForm**
> Void updatePetWithForm(petId, name, status)
> updatePetWithForm(petId, name, status)
Updates a pet in the store with form data
@@ -364,8 +361,7 @@ Long petId = 789L; // Long | ID of pet that needs to be updated
String name = "name_example"; // String | Updated name of the pet
String status = "status_example"; // String | Updated status of the pet
try {
Void result = apiInstance.updatePetWithForm(petId, name, status);
System.out.println(result);
apiInstance.updatePetWithForm(petId, name, status);
} catch (ApiException e) {
System.err.println("Exception when calling PetApi#updatePetWithForm");
e.printStackTrace();
@@ -382,7 +378,7 @@ Name | Type | Description | Notes
### Return type
[**Void**](.md)
null (empty response body)
### Authorization