Class RequestController
Network requests handler.
Inherited Members
Namespace: EduCATS.Networking
Assembly: EduCATS.dll
Syntax
public class RequestController
Constructors
RequestController(string, IPlatformServices)
Constructor.
Declaration
public RequestController(string url = null, IPlatformServices services = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | url | URL. |
| IPlatformServices | services | Platform services. |
Fields
_services
Declaration
public IPlatformServices _services
Field Value
| Type | Description |
|---|---|
| IPlatformServices |
RequestTimeoutMilliseconds
Request timeout in milliseconds.
Declaration
public const int RequestTimeoutMilliseconds = 300000
Field Value
| Type | Description |
|---|---|
| int |
RequestTimeoutSeconds
Request timeout in seconds.
Declaration
public const int RequestTimeoutSeconds = 300
Field Value
| Type | Description |
|---|---|
| int |
Properties
Uri
Parsed URL.
Declaration
public Uri Uri { get; }
Property Value
| Type | Description |
|---|---|
| Uri |
Url
URL.
Declaration
public string Url { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
ResetHttpClient()
Reset shared HTTP client.
Declaration
public static void ResetHttpClient()
Remarks
Use before login/re-login to rebuild transport state.
SendRequest(HttpMethod)
Send request.
Declaration
public Task<HttpResponseMessage> SendRequest(HttpMethod httpMethod)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpMethod | httpMethod |
|
Returns
| Type | Description |
|---|---|
| Task<HttpResponseMessage> | Response. |
Remarks
GET and POST requests are supported only.
SetPostContent(string, Encoding, string)
Set POST content.
Declaration
public void SetPostContent(string content, Encoding encoding, string mediaType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | content | Content. |
| Encoding | encoding | Encoding. |
| string | mediaType | Content type. |