i found that the result $request.ContentType is difference by using char[] and String.
$request = [System.Net.HttpWebRequest].create($URL)
$request.ContentType = [char[]] "application/x-www-url-formurlened" $request.ContentType = "application/x-www-url-formurlened"
What is the different in the actual output to the server side, if I made a request like that using char[] and string?
it is so confusing…i guess it should be the same
thanks
I think I figured out the issue. Check this out:
Powershell will cast your
char[]into astring, sinceHttpRequest.ContentTypeis of typestring, but for when Powershell converts arrays to strings it inserts a the value of the special variable$OFSbetween each element. The help for about_special_variables has information on$OFS(and other things). The default for$OFSis a space which explains this behavior.(Thanks to BartekB for pointing out $OFS in the comments.)