On Wed, 2011-06-29 at 10:15 +0200, khiem nguyen wrote:
> hi
> i have a post request like this:
> 
> param1=value1&param2=&param3=value3
> 
> if i put these into a ArrayList<NameValuePair> for a POST, should the value
> of param2 an empty-string or should it be null ? does defaultHttpClient
> handle these 2 cases differently ?
> 
> thanx
> 
> cheers

Khiem,

HttpClient handles treats empty and null parameter values the same

List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("p1", ""));
nvps.add(new BasicNameValuePair("p2", null));
System.out.println(URLEncodedUtils.format(nvps, HTTP.ASCII));

> p1=&p2=

Hope this helps

Oleg 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to