File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,12 @@ public bool RemoveHeader(string key)
8787 return headers . Remove ( key ) ;
8888 }
8989
90+ public HttpRequest SetTimeout ( int duration )
91+ {
92+ unityWebRequest . timeout = duration ;
93+ return this ;
94+ }
95+
9096 public HttpRequest Send ( )
9197 {
9298 foreach ( var header in headers )
@@ -98,6 +104,12 @@ public HttpRequest Send()
98104 return this ;
99105 }
100106
107+ public HttpRequest SetRedirectLimit ( int redirectLimit )
108+ {
109+ UnityWebRequest . redirectLimit = redirectLimit ;
110+ return this ;
111+ }
112+
101113 public void Abort ( )
102114 {
103115 Http . Instance . Abort ( this ) ;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ public class HttpResponse
1414 public ResponseType ResponseType { get ; private set ; }
1515 public byte [ ] Bytes { get ; private set ; }
1616 public string Text { get ; private set ; }
17+ public string Error { get ; private set ; }
1718 public Texture Texture { get ; private set ; }
1819 public Dictionary < string , string > ResponseHeaders { get ; private set ; }
1920
@@ -25,6 +26,7 @@ public HttpResponse(UnityWebRequest unityWebRequest)
2526 IsSuccessful = ! unityWebRequest . isHttpError && ! unityWebRequest . isNetworkError ;
2627 IsHttpError = unityWebRequest . isHttpError ;
2728 IsNetworkError = unityWebRequest . isNetworkError ;
29+ Error = unityWebRequest . error ;
2830 StatusCode = unityWebRequest . responseCode ;
2931 ResponseType = HttpUtils . GetResponseType ( StatusCode ) ;
3032 ResponseHeaders = unityWebRequest . GetResponseHeaders ( ) ;
Original file line number Diff line number Diff line change @@ -72,6 +72,12 @@ All these methods return the HttpRequest instance.
7272##### Progress
7373* ` OnUploadProgress(Action<float> progress) `
7474* ` OnDownloadProgress(Action<float> progress) `
75+ ##### Configure
76+ * ` SetRedirectLimit(int redirectLimit) `
77+ * ` SetTimeout(int duration) `
78+
79+ Redirect limit subject to Unity's documentation.
80+ * [ Redirect Limit Documentation] ( https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest-redirectLimit.html )
7581
7682Progress events will invoke each time the progress value has increased, they are subject to Unity's documentation.
7783* [ Upload Progress Documentation] ( https://docs.unity3d.com/ScriptReference/Networking.UnityWebRequest-uploadProgress.html )
@@ -94,6 +100,7 @@ This has the following properties:
94100* ` ResponseType ResponseType `
95101* ` byte[] Bytes `
96102* ` string Text `
103+ * ` string Error `
97104* ` Texture Texture `
98105* ` Dictionary<string, string> ResponseHeaders `
99106
You can’t perform that action at this time.
0 commit comments