Api Sandbox Http
class

Http

public static abstract sealed class Http

Lets your game make async HTTP requests.

Methods

static Boolean IsAllowed(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

uri — The Uri to check.
returns — True if the Uri can be accessed, false if the Uri will be blocked.
static Boolean IsHeaderAllowed(String header)

Checks if a given header is allowed to be set.

header — The header name to check.
returns — True if the header is allowed to be set.
static Task<String> RequestStringAsync(String requestUri, String method = GET, HttpContent content = null, Dictionary<String, String> headers = null, CancellationToken cancellationToken = null)
static Task<Byte[]> RequestBytesAsync(String requestUri, String method = GET, HttpContent content = null, Dictionary<String, String> headers = null, CancellationToken cancellationToken = null)
static Task<Stream> RequestStreamAsync(String requestUri, String method = GET, HttpContent content = null, Dictionary<String, String> headers = null, CancellationToken cancellationToken = null)
static Task<T> RequestJsonAsync(String requestUri, String method = GET, HttpContent content = null, Dictionary<String, String> headers = null, CancellationToken cancellationToken = null)
static Task<HttpResponseMessage> RequestAsync(String requestUri, String method = GET, HttpContent content = null, Dictionary<String, String> headers = null, CancellationToken cancellationToken = null)
static HttpContent CreateJsonContent(T target)

Creates a new HttpContent instance containing the specified object serialized to JSON.

Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.Http