Skip to content

Commit c815ea6

Browse files
committed
Merge pull request android-async-http#275 from usepropeller/request_params_add
Add RequestParams#add
2 parents 4b6eb97 + d952527 commit c815ea6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,22 @@ public void put(String key, ArrayList<String> values) {
142142
}
143143
}
144144

145+
/**
146+
* Adds value to param which can have more than one value.
147+
* @param key the key name for the param, either existing or new.
148+
* @param value the value string for the new param.
149+
*/
150+
public void add(String key, String value) {
151+
if(key != null && value != null) {
152+
ArrayList<String> paramArray = urlParamsWithArray.get(key);
153+
if (paramArray == null) {
154+
paramArray = new ArrayList<String>();
155+
this.put(key, paramArray);
156+
}
157+
paramArray.add(value);
158+
}
159+
}
160+
145161
/**
146162
* Adds an input stream to the request.
147163
* @param key the key name for the new param.

0 commit comments

Comments
 (0)