Example #1
0
        //Used in request to url entered by user for image, returns just the content type header info
        private IEnumerator transmit(UnityWebRequest request, ImageUrlCheck callback)
        {
            KXAPI.log("sending request to: " + request.url);
            yield return(request.Send());

            callback(request.GetResponseHeaders()["Content-Type"]);
        }
Example #2
0
        //This differs from the other HTTP static methods in that is doesn't return anything and only fetches the HEADER info from the url
        //It also uses a different method in the RequestHandler which doesn't deal with status codes and only returns the Content-Type into the callback.
        //This is the one route which will make calls to other sites, but only to urls entered by the user for images
        internal static void verify_image(string url, ImageUrlCheck callback)
        {
            HTTP http = new HTTP();

            http.request        = UnityWebRequest.Get(url);
            http.request.method = "HEAD";
            http.send(callback);
        }
Example #3
0
//        private UnityWebRequest last_request = null;
//        private RequestCallback last_callback = null;
//        private KerbalXAPI api_instance = null;

//        public void try_again(){
//            send_request(api_instance, last_request, last_callback);
//        }
//
//        public bool can_retry(){
//            return last_request != null;
//        }


        //Used to fetch Content-Type Header info for urls entered by user for an image (to check if image is an image)
        internal void send_request(UnityWebRequest request, ImageUrlCheck callback)
        {
            StartCoroutine(transmit(request, callback));
        }
Example #4
0
 //override for send when using ImageUrlCheck callback
 internal void send(ImageUrlCheck callback)
 {
     RequestHandler.instance.send_request(request, callback);
 }