using UnityEngine.Networking; namespace Proyecto26 { public partial class RequestHelper { /// /// Internal use /// public UnityWebRequest Request { private get; set; } /// /// Returns a floating-point value between 0.0 and 1.0, indicating the progress of uploading body data to the server. /// public float UploadProgress { get { float progress = 0; if (this.Request != null) { progress = this.Request.uploadProgress; } return progress; } } /// /// Returns the number of bytes of body data the system has uploaded to the remote server. (Read Only) /// public ulong UploadedBytes { get { ulong bytes = 0; if (this.Request != null) { bytes = this.Request.uploadedBytes; } return bytes; } } /// /// Returns a floating-point value between 0.0 and 1.0, indicating the progress of downloading body data from the server. (Read Only) /// public float DownloadProgress { get { float progress = 0; if (this.Request != null) { progress = this.Request.downloadProgress; } return progress; } } /// /// Returns the number of bytes of body data the system has downloaded from the remote server. (Read Only) /// public ulong DownloadedBytes { get { ulong bytes = 0; if (this.Request != null) { bytes = this.Request.downloadedBytes; } return bytes; } } /// /// Get the value of a header /// /// The string value of the header. /// The name of the header. public string GetHeader(string name) { string headerValue; if (this.Request != null) { headerValue = this.Request.GetRequestHeader(name); } else { this.Headers.TryGetValue(name, out headerValue); } return headerValue; } private bool _isAborted; /// /// Check if the request was aborted /// /// A boolean to know if the request was aborted by the user public bool IsAborted { get { return _isAborted; } set { _isAborted = value; } } private bool _defaultContentType = true; /// /// Enable or Disable Content Type JSON by default /// /// Check if application/json is enabled by default public bool DefaultContentType { get { return _defaultContentType; } set { _defaultContentType = value; } } /// /// Abort the request manually /// public void Abort() { if (this.Request != null && !this.IsAborted) { try { this.IsAborted = true; this.Request.Abort(); } finally { this.Request = null; } } } } }