@@ -70,10 +70,12 @@ public void SetSuperHeader(string key, string value)
7070 {
7171 throw new ArgumentException ( "Key cannot be null or empty." ) ;
7272 }
73+
7374 if ( string . IsNullOrEmpty ( value ) )
7475 {
7576 throw new ArgumentException ( "Value cannot be null or empty, if you are intending to remove the value, use the RemoveSuperHeader() method." ) ;
7677 }
78+
7779 superHeaders [ key ] = value ;
7880 }
7981
@@ -88,6 +90,7 @@ public bool RemoveSuperHeader(string key)
8890 {
8991 throw new ArgumentException ( "Key cannot be null or empty." ) ;
9092 }
93+
9194 return superHeaders . Remove ( key ) ;
9295 }
9396
@@ -194,9 +197,9 @@ public static HttpRequest Head(string uri)
194197 /// <param name="request">The request to transmit</param>
195198 /// <param name="onSuccess">The callback for on success response from the server</param>
196199 /// <param name="onError">The callback for on error with the request or response.</param>
197- public void Send ( HttpRequest request , Action < HttpResponse > onSuccess = null , Action < HttpResponse > onError = null )
200+ public Coroutine Send ( HttpRequest request , Action < HttpResponse > onSuccess = null , Action < HttpResponse > onError = null )
198201 {
199- StartCoroutine ( SendCoroutine ( request , onSuccess , onError ) ) ;
202+ return StartCoroutine ( SendCoroutine ( request , onSuccess , onError ) ) ;
200203 }
201204
202205 /// <summary>
@@ -206,10 +209,10 @@ public void Send(HttpRequest request, Action<HttpResponse> onSuccess = null, Act
206209 /// <param name="onSuccess">The callback for on success response from the server</param>
207210 /// <param name="onError">THe callback for on error with the request or response.</param>
208211 /// <param name="onNetworkError">The callback for on network error with the request.</param>
209- public void Send ( UnityWebRequest unityWebRequest , Action < UnityWebRequest > onSuccess = null ,
212+ public Coroutine Send ( UnityWebRequest unityWebRequest , Action < UnityWebRequest > onSuccess = null ,
210213 Action < UnityWebRequest > onError = null , Action < UnityWebRequest > onNetworkError = null )
211214 {
212- StartCoroutine ( SendCoroutine ( unityWebRequest , onSuccess , onError , onNetworkError ) ) ;
215+ return StartCoroutine ( SendCoroutine ( unityWebRequest , onSuccess , onError , onNetworkError ) ) ;
213216 }
214217
215218 /// <summary>
@@ -219,10 +222,10 @@ public void Send(UnityWebRequest unityWebRequest, Action<UnityWebRequest> onSucc
219222 /// <param name="onSuccess">The callback for on success response from the server</param>
220223 /// <param name="onError">The callback for on error with the request or response.</param>
221224 /// <param name="onNetworkError">The callback for on network error with the request.</param>
222- public void Send ( UnityWebRequest unityWebRequest , Action onSuccess = null ,
225+ public Coroutine Send ( UnityWebRequest unityWebRequest , Action onSuccess = null ,
223226 Action onError = null , Action onNetworkError = null )
224227 {
225- StartCoroutine ( SendCoroutine ( unityWebRequest , onSuccess , onError , onNetworkError ) ) ;
228+ return StartCoroutine ( SendCoroutine ( unityWebRequest , onSuccess , onError , onNetworkError ) ) ;
226229 }
227230
228231 /// <summary>
@@ -231,10 +234,19 @@ public void Send(UnityWebRequest unityWebRequest, Action onSuccess = null,
231234 /// <param name="unityWebRequest">The request to transmit</param>
232235 /// <param name="onSuccess">The callback for on success response from the server</param>
233236 /// <param name="onError">The callback for on error with the request or response.</param>
234- public void Send ( UnityWebRequest unityWebRequest , Action < HttpResponse > onSuccess = null ,
237+ public Coroutine Send ( UnityWebRequest unityWebRequest , Action < HttpResponse > onSuccess = null ,
235238 Action < HttpResponse > onError = null )
236239 {
237- StartCoroutine ( SendCoroutine ( unityWebRequest , onSuccess , onError ) ) ;
240+ return StartCoroutine ( SendCoroutine ( unityWebRequest , onSuccess , onError ) ) ;
241+ }
242+
243+ #endregion
244+
245+ #region Abort HttpRequest method
246+
247+ public void Abort ( Coroutine coroutine )
248+ {
249+ StopCoroutine ( coroutine ) ;
238250 }
239251
240252 #endregion
@@ -358,4 +370,4 @@ private static IEnumerator SendCoroutine(UnityWebRequest request,
358370
359371 #endregion
360372 }
361- }
373+ }
0 commit comments