UnityEngine.WWW does not return body with Http 500 error?

I’m using UnityEngine.WWW to talk to a SOAP-based service that returns HTTP status code 500 along with the fault exception in the body. The behavior I’m seeing is that it does not return the body (i.e. WWW.text property) when it sees status code 500. I verified that the service does return the fault in the body via Fiddler (web debugging proxy). Is this expected behavior? Any workaround for it?

This is what I have:

            var serviceUrl = "http://localhost/service/service.asmx";

            var requestPayload = @"<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"">
                <soapenv:Header/>
                    <soapenv:Body>
                    ...
                    </soapenv:Body>
                    </soapenv:Envelope>";

            var postData = Encoding.UTF8.GetBytes(requestPayload);

            var headers = new System.Collections.Hashtable();
            headers ["Content-Type"] = "text/xml;charset=UTF-8";
            headers ["SOAPAction"] = "http://...";

            WWW www = new WWW(serviceUrl, postData, headers);

            _context.StartCoroutine(WaitForRequest(www));


        IEnumerator WaitForRequest(WWW www)
        {
            yield return www;

            // empty if http status cod 500
            Debug.Log("WWW: " + www.text);

        }

Thanks!

Server errors are treated as a failure condition, WWW.text will be empty, and WWW.error will be set.

I have confirmed that this is properly fixed in 5.1.x. Previously when WWW.error is not empty/not null, WWW.text will always throw. In 5.1.x WWW.text will properly show the error message even if WWW.error return 400 Bad Request.

Unfortunately, 4.6.6f still doesn’t have this fix.