Helpers for working with HTTP

Constants

enableStandardWebSocket → bool

const bool.fromEnvironment("calzone.build", defaultValue: false) || const bool.fromEnvironment("websocket.standard", defaultValue: true)

Static Properties

client → HttpClient

Main HTTP Client

read / write

Static Methods

connectToWebSocket(String url, { Iterable<String> protocols, Map<String, dynamic> headers, HttpClient httpClient, bool useStandardWebSocket }) → Future<WebSocket>

Custom WebSocket Connection logic.

createRequest(String method, String url, { Map<String, String> headers }) → Future<HttpClientRequest>

Creates an HttpClientRequest with the given parameters. method is the HTTP method. url is the URL to make the request to. headers specifies additional headers to set.

fetchJSON(String url, { Map<String, String> headers }) → Future

Fetches the specified url from HTTP as JSON. If headers is specified, the headers will be added onto the request.

fetchUrl(String url, { Map<String, String> headers }) → Future<String>

Fetches the specified url from HTTP. If headers is specified, the headers will be added onto the request.

readBytesFromResponse(HttpClientResponse response) → Future<List<int>>

Reads the entire response as a list of bytes.

tokenizeFieldValue(String headerValue) → List<String>

upgradeToWebSocket(HttpRequest request, [ dynamic protocolSelector(List<String> protocols), bool useStandardWebSocket ]) → Future<WebSocket>

Constructors

HttpHelper()

Properties

hashCode → int

The hash code for this object.

read-only, inherited
runtimeType → Type

A representation of the runtime type of the object.

read-only, inherited

Operators

operator ==(other) → bool

The equality operator.

inherited

Methods

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() → String

Returns a string representation of this object.

inherited