Skip to content

Commit 3602cc7

Browse files
authored
Fix api reuse bug when calling cloudinary.search() (#232)
1 parent 4cb7762 commit 3602cc7

File tree

1 file changed

+3
-3
lines changed
  • cloudinary-core/src/main/java/com/cloudinary

1 file changed

+3
-3
lines changed

cloudinary-core/src/main/java/com/cloudinary/Search.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
public class Search {
1212

13-
private Cloudinary cloudinary;
13+
private final Api api;
1414
private ArrayList<HashMap<String, Object>> sortByParam;
1515
private ArrayList<String> aggregateParam;
1616
private ArrayList<String> withFieldParam;
1717
private HashMap<String, Object> params;
1818

1919
Search(Cloudinary cloudinary) {
20-
this.cloudinary = cloudinary;
20+
this.api = cloudinary.api();
2121
this.params = new HashMap<String, Object>();
2222
this.sortByParam = new ArrayList<HashMap<String, Object>>();
2323
this.aggregateParam = new ArrayList<String>();
@@ -66,6 +66,6 @@ public HashMap<String, Object> toQuery() {
6666

6767
public ApiResponse execute() throws Exception {
6868
Map<String, String> options = ObjectUtils.asMap("content_type", "json");
69-
return this.cloudinary.api().callApi(Api.HttpMethod.POST, Arrays.asList("resources", "search"), this.toQuery(), options);
69+
return this.api.callApi(Api.HttpMethod.POST, Arrays.asList("resources", "search"), this.toQuery(), options);
7070
}
7171
}

0 commit comments

Comments
 (0)