Hi,
I’m using WWW to call a RESTful api (azure table storage) but I when I attempt to POST to the server Fiddler shows that CONNECT is being used and the url is slightly wrong.
I’m using the following:
public static WWW PostDataOnServer(string url, byte[] data, Dictionary<string, string> headers)
{
Debug.Log("Posting data to: " + url);
return new WWW(url, data, headers);
}
Where the url= https://myAccount.table.core.windows.net/Tables
The byte data is a UTF8 encoded version of the following string:
"{
"TableName":"TableTest"
}"
And I’m using the following headers: Date, x-ms-version, Content-Type, Content-Length, Authorization.
Fiddler shows that WWW is sending the following:
CONNECT myAccount.table.core.windows.net:443 HTTP/1.1
Host: myAccount.table.core.windows.net:443
User-Agent: UnityPlayer/4.3.4f1 (http://unity3d.com)
Proxy-Connection: Keep-Alive
Authorization: SharedKeyLite myAccount:mysharedKey=
Content-Length: 28
Content-Type: application/json
Date: Mon, 17 Feb 2014 11:40:31 GMT
x-ms-version: 2013-08-15
That first line should be reading as:
POST https://myAccount.table.core.windows.net/Tables HTTP/1.1
The host address shouldn’t be showing port 433 either. I’ve double checked that the correct address is going in (you’ll see the Debug.Log in the method which prints out the correct url as it goes into the new WWW).
Using GET (by not including data in when creating the WWW) works fine and doesn’t alter the url or insert an incorrect verb.
Any ideas why it’s not calling the POST verb and why my url is being altered by WWW?
Best Regards
Hobsie