IEnumerator DemoCacheControl() { _test = "DemoCacheControl"; HTTPRequest request = new HTTPRequest(); request.SetURL("http://www.google.com"). AppendQueryParameter("q", "unity"); HTTPResponseMemoryStreamHandler responseHandler = new HTTPResponseMemoryStreamHandler(); responseHandler.SetCachePolicy(CachePolicy.ReloadIgnoringLocalAndRemoteCacheData); using (_client = new HTTPClient(request, responseHandler)) { yield return(StartCoroutine(_client.WaitUntilDone())); DebugAll(_client); } }
IEnumerator DemoAcceptInvalidHTTPSCertificates() { _test = "DemoAcceptInvalidHTTPSCertificates"; HTTPRequest request = new HTTPRequest(); request.SetURL("https://google.com"). AppendQueryParameter("q", "unity"); HTTPResponseMemoryStreamHandler responseHandler = new HTTPResponseMemoryStreamHandler(); responseHandler.SetAllowInvalidSSLCertificates(true); using (_client = new HTTPClient(request, responseHandler)) { yield return(StartCoroutine(_client.WaitUntilDone())); DebugAll(_client); } }
IEnumerator DemoAcceptableStatusCodes() { _test = "DemoAcceptableStatusCodes"; HTTPRequest request = new HTTPRequest(); request.SetURL("http://google.com/nonexistent"). AppendQueryParameter("q", "unity"); HTTPResponseMemoryStreamHandler responseHandler = new HTTPResponseMemoryStreamHandler(); responseHandler.AddAcceptableStatusCodeRange(200, 299); using (_client = new HTTPClient(request, responseHandler)) { yield return(StartCoroutine(_client.WaitUntilDone())); DebugAll(_client); } }
IEnumerator DemoRedirectControl() { _test = "DemoRedirectControl"; HTTPRequest request = new HTTPRequest(); request.SetURL("https://google.com"). AppendQueryParameter("q", "unity"); HTTPResponseMemoryStreamHandler responseHandler = new HTTPResponseMemoryStreamHandler(); responseHandler.SetAllowFollowRedirects(true); responseHandler.SetMaxRedirectCount(10); using (_client = new HTTPClient(request, responseHandler)) { yield return(StartCoroutine(_client.WaitUntilDone())); DebugAll(_client); } }