> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/reactor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/reactor/api-reference/ks.reactor.client.unity/ks.reactor.client.unity.ksunitywebrequest.md).

# Class ksUnityWebRequest

Namespace: [KS.Reactor.Client.Unity](/reactor/api-reference/ks.reactor.client.unity.md)\
Assembly: KSUnity-Source.dll

Handles web requests using the Unity UnityWebRequest object.

```csharp
public class ksUnityWebRequest : ksIWebRequest
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) â† [ksUnityWebRequest](/reactor/api-reference/ks.reactor.client.unity/ks.reactor.client.unity.ksunitywebrequest.md)

#### Implements

[ksIWebRequest](/reactor/api-reference/ks.reactor/ks.reactor.ksiwebrequest.md)

#### Inherited Members

[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)), [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)), [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype), [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone), [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Constructors

### ksUnityWebRequest(string, WebHeaderCollection, string, ksJSON, object) <a href="#ks_reactor_client_unity_ksunitywebrequest__ctor_system_string_system_net_webheadercollection_system" id="ks_reactor_client_unity_ksunitywebrequest__ctor_system_string_system_net_webheadercollection_system"></a>

Constructor

```csharp
public ksUnityWebRequest(string url, WebHeaderCollection headers = null, string method = "GET", ksJSON jsonRequest = null, object asyncState = null)
```

#### Parameters

`url` [string](https://learn.microsoft.com/dotnet/api/system.string)

URL for the request.

`headers` [WebHeaderCollection](https://learn.microsoft.com/dotnet/api/system.net.webheadercollection)

Header collection with a default of null.

`method` [string](https://learn.microsoft.com/dotnet/api/system.string)

Request method with a default of null resolving to GET.

`jsonRequest` [ksJSON](/reactor/api-reference/ks.reactor/ks.reactor.ksjson.md)

JSON request data.

`asyncState` [object](https://learn.microsoft.com/dotnet/api/system.object)

User defined state tracking object.

## Properties

### Headers <a href="#ks_reactor_client_unity_ksunitywebrequest_headers" id="ks_reactor_client_unity_ksunitywebrequest_headers"></a>

Headers

```csharp
public WebHeaderCollection Headers { get; }
```

#### Property Value

[WebHeaderCollection](https://learn.microsoft.com/dotnet/api/system.net.webheadercollection)

### IsDone <a href="#ks_reactor_client_unity_ksunitywebrequest_isdone" id="ks_reactor_client_unity_ksunitywebrequest_isdone"></a>

Is the request completed?

```csharp
public bool IsDone { get; }
```

#### Property Value

[bool](https://learn.microsoft.com/dotnet/api/system.boolean)

### JSON <a href="#ks_reactor_client_unity_ksunitywebrequest_json" id="ks_reactor_client_unity_ksunitywebrequest_json"></a>

JSON request data.

```csharp
public ksJSON JSON { get; }
```

#### Property Value

[ksJSON](/reactor/api-reference/ks.reactor/ks.reactor.ksjson.md)

### Method <a href="#ks_reactor_client_unity_ksunitywebrequest_method" id="ks_reactor_client_unity_ksunitywebrequest_method"></a>

Method

```csharp
public string Method { get; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### Response <a href="#ks_reactor_client_unity_ksunitywebrequest_response" id="ks_reactor_client_unity_ksunitywebrequest_response"></a>

Response

```csharp
public ksWebResponse Response { get; }
```

#### Property Value

[ksWebResponse](/reactor/api-reference/ks.reactor/ks.reactor.kswebresponse.md)

### SendTime <a href="#ks_reactor_client_unity_ksunitywebrequest_sendtime" id="ks_reactor_client_unity_ksunitywebrequest_sendtime"></a>

Time in ticks when the request was sent.

```csharp
public long SendTime { get; }
```

#### Property Value

[long](https://learn.microsoft.com/dotnet/api/system.int64)

### URL <a href="#ks_reactor_client_unity_ksunitywebrequest_url" id="ks_reactor_client_unity_ksunitywebrequest_url"></a>

URL

```csharp
public string URL { get; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

## Methods

### CompleteRequest() <a href="#ks_reactor_client_unity_ksunitywebrequest_completerequest" id="ks_reactor_client_unity_ksunitywebrequest_completerequest"></a>

Complete the request and fill the response object.

```csharp
public void CompleteRequest()
```

### Create(string, WebHeaderCollection, string, ksJSON, object) <a href="#ks_reactor_client_unity_ksunitywebrequest_create_system_string_system_net_webheadercollection_system" id="ks_reactor_client_unity_ksunitywebrequest_create_system_string_system_net_webheadercollection_system"></a>

```csharp
public static ksIWebRequest Create(string url, WebHeaderCollection headers = null, string method = null, ksJSON request = null, object asyncState = null)
```

#### Parameters

`url` [string](https://learn.microsoft.com/dotnet/api/system.string)

`headers` [WebHeaderCollection](https://learn.microsoft.com/dotnet/api/system.net.webheadercollection)

`method` [string](https://learn.microsoft.com/dotnet/api/system.string)

`request` [ksJSON](/reactor/api-reference/ks.reactor/ks.reactor.ksjson.md)

`asyncState` [object](https://learn.microsoft.com/dotnet/api/system.object)

#### Returns

[ksIWebRequest](/reactor/api-reference/ks.reactor/ks.reactor.ksiwebrequest.md)
