What is the correct approach for sending null values in http post/get requests.
Important: I'm meaning to send NULL value for an specific param of the request, not empty strings or missing fields. I considered the following options as incorrect
http://test.com?param1=¶m2=bar //this is an empty string, not a null
http://test.com?param1=null¶m2=bar //this is a string with content "null"
http://test.com?param2=bar //param 1 is missing, not null
Does sending a NULL make sense in HTTP (and is standardised) or should I fallback to any of the previous options? In the latter case, whats is the standard approach
In java when I use:
URLEncoder.encode(null, "UTF-8")
It crashes with Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
I also get a crash when using OkHttp3 lib and try to add a null param
FormBody.Builder bodyBuilder = new FormBody.Builder();
bodyBuilder.add("param1",null)