Skip to content

Commit 9aaa615

Browse files
committed
Updated documentation on arrays on RequestParams, replaced for with foreach, better debugging of file arrays in toString(), android-async-http#862
1 parent 527dae4 commit 9aaa615

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

library/src/main/java/com/loopj/android/http/RequestParams.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@
6868
* List<String> list = new ArrayList<String>(); // Ordered collection
6969
* list.add("Java");
7070
* list.add("C");
71-
* params.put("languages", list); // url params: "languages[]=Java&languages[]=C"
71+
* params.put("languages", list); // url params: "languages[0]=Java&languages[1]=C"
7272
*
7373
* String[] colors = { "blue", "yellow" }; // Ordered collection
74-
* params.put("colors", colors); // url params: "colors[]=blue&colors[]=yellow"
74+
* params.put("colors", colors); // url params: "colors[0]=blue&colors[1]=yellow"
7575
*
7676
* File[] files = { new File("pic.jpg"), new File("pic1.jpg") }; // Ordered collection
7777
* params.put("files", files); // url params: "files[]=pic.jpg&files[]=pic1.jpg"
@@ -228,11 +228,11 @@ public void put(String key, File files[], String contentType, String customFileN
228228

229229
if (key != null) {
230230
List<FileWrapper> fileWrappers = new ArrayList<FileWrapper>();
231-
for (int i = 0; i < files.length; i++) {
232-
if (files[i] == null || !files[i].exists()) {
231+
for (File file : files) {
232+
if (file == null || !file.exists()) {
233233
throw new FileNotFoundException();
234234
}
235-
fileWrappers.add(new FileWrapper(files[i], contentType, customFileName));
235+
fileWrappers.add(new FileWrapper(file, contentType, customFileName));
236236
}
237237
fileArrayParams.put(key, fileWrappers);
238238
}
@@ -460,7 +460,7 @@ public String toString() {
460460

461461
result.append(entry.getKey());
462462
result.append("=");
463-
result.append("FILE");
463+
result.append("FILES(SIZE=").append(entry.getValue().size()).append(")");
464464
}
465465

466466
List<BasicNameValuePair> params = getParamsList(null, urlParamsWithObjects);

0 commit comments

Comments
 (0)