You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@juneau.apache.org by James Bognar <ja...@apache.org> on 2017/05/22 18:43:19 UTC

null vs empty on headers/query/form-data fields.

So I'm struggling a bit on how to handle null vs empty fields on headers,
queries, and form-data fields.  I'm leaning towards the following rule:

   - A null value on a header, query, or form-data is equivalent to not
   setting that value at all.

So if you try to add a query parameter foo=null, the foo parameter will not
be added at all.  Empty strings however (foo="") do get added.

@Header/@Query/@FormData will not add a value if the value is null.
@HeaderIfNE/@QueryIfNE/@FormDataIfNE will not add a value if the value is
null or empty.

One wrinkle is the value of the query parameter that has no value:  "&foo".

If you call getParameter("foo") on WebSphere Application Server, you get an
empty string.
If you call getParameter("foo") on Jetty, you get null.

I think we should treat "&foo" and "&foo=" as synonymous, and
getParameter("foo") should return an empty string.