s&box docs

public static abstract sealed class Sandbox.Http

Lets your game make async HTTP requests.

Broader workflow and conceptual references connected to this API.

Methods

Showing 8 methods

public static System.Net.Http.HttpContent CreateJsonContent(T target)

Creates a new `System.Net.Http.HttpContent` instance containing the specified object serialized to JSON.

public static bool IsAllowed(System.Uri uri)

Check if the given Uri matches the following requirements: 1. Scheme is https/http or wss/ws 2. If it's localhost, only allow ports 80/443/8080/8443 3. Not an ip address

Parameters

  • uri: The Uri to check.

Returns

True if the Uri can be accessed, false if the Uri will be blocked.

public static bool IsHeaderAllowed(string header)

Checks if a given header is allowed to be set.

Parameters

  • header: The header name to check.

Returns

True if the header is allowed to be set.

public static System.Threading.Tasks.Task`1<System.Net.Http.HttpResponseMessage> RequestAsync(string requestUri, string method = GET, System.Net.Http.HttpContent content = null, System.Collections.Generic.Dictionary`2<string,string> headers = null, System.Threading.CancellationToken cancellationToken = null)

Parameters

  • method: Default: GET
  • content: Default: null
  • headers: Default: null
  • cancellationToken: Default: null

public static System.Threading.Tasks.Task`1<byte[]> RequestBytesAsync(string requestUri, string method = GET, System.Net.Http.HttpContent content = null, System.Collections.Generic.Dictionary`2<string,string> headers = null, System.Threading.CancellationToken cancellationToken = null)

Parameters

  • method: Default: GET
  • content: Default: null
  • headers: Default: null
  • cancellationToken: Default: null

public static System.Threading.Tasks.Task`1<T> RequestJsonAsync(string requestUri, string method = GET, System.Net.Http.HttpContent content = null, System.Collections.Generic.Dictionary`2<string,string> headers = null, System.Threading.CancellationToken cancellationToken = null)

Parameters

  • method: Default: GET
  • content: Default: null
  • headers: Default: null
  • cancellationToken: Default: null

public static System.Threading.Tasks.Task`1<System.IO.Stream> RequestStreamAsync(string requestUri, string method = GET, System.Net.Http.HttpContent content = null, System.Collections.Generic.Dictionary`2<string,string> headers = null, System.Threading.CancellationToken cancellationToken = null)

Parameters

  • method: Default: GET
  • content: Default: null
  • headers: Default: null
  • cancellationToken: Default: null

public static System.Threading.Tasks.Task`1<string> RequestStringAsync(string requestUri, string method = GET, System.Net.Http.HttpContent content = null, System.Collections.Generic.Dictionary`2<string,string> headers = null, System.Threading.CancellationToken cancellationToken = null)

Parameters

  • method: Default: GET
  • content: Default: null
  • headers: Default: null
  • cancellationToken: Default: null

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.Engine
Doc IDT:Sandbox.Http

On this page

Methodspublic static System.Net.Http.HttpContent CreateJsonContent(T target)public static System.Boolean IsAllowed(System.Uri uri)public static System.Boolean IsHeaderAllowed(System.String header)public static System.Threading.Tasks.Task`1<System.Net.Http.HttpResponseMessage> RequestAsync(System.String requestUri, System.String method = GET, System.Net.Http.HttpContent content = null, System.Collections.Generic.Dictionary`2<System.String,System.String> headers = null, System.Threading.CancellationToken cancellationToken = null)public static System.Threading.Tasks.Task`1<System.Byte[]> RequestBytesAsync(System.String requestUri, System.String method = GET, System.Net.Http.HttpContent content = null, System.Collections.Generic.Dictionary`2<System.String,System.String> headers = null, System.Threading.CancellationToken cancellationToken = null)public static System.Threading.Tasks.Task`1<T> RequestJsonAsync(System.String requestUri, System.String method = GET, System.Net.Http.HttpContent content = null, System.Collections.Generic.Dictionary`2<System.String,System.String> headers = null, System.Threading.CancellationToken cancellationToken = null)public static System.Threading.Tasks.Task`1<System.IO.Stream> RequestStreamAsync(System.String requestUri, System.String method = GET, System.Net.Http.HttpContent content = null, System.Collections.Generic.Dictionary`2<System.String,System.String> headers = null, System.Threading.CancellationToken cancellationToken = null)public static System.Threading.Tasks.Task`1<System.String> RequestStringAsync(System.String requestUri, System.String method = GET, System.Net.Http.HttpContent content = null, System.Collections.Generic.Dictionary`2<System.String,System.String> headers = null, System.Threading.CancellationToken cancellationToken = null)Metadata