Provides encoding and decoding services based on the ContentType of a Request or Response.

The defaultInstance provides a lookup table of ContentType to Codec. By default, 'application/json', 'application/x-www-form-urlencoded' and 'text/*' content types have codecs and can transform a Response.body into a list of bytes that can be transferred as an HTTP response body.

Additional mappings are added via add. This method must be called per-isolate and it is recommended to add mappings in an application's RequestSink subclass constructor.

Static Properties

defaultInstance HTTPCodecRepository

The instance used by Aqueduct to encode and decode HTTP bodies.

read-only

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

add(ContentType contentType, Codec codec, { bool allowCompression: true }) → void

Adds a custom codec for contentType.

codecForContentType(ContentType contentType) → Codec

Returns a Codec for contentType.

isContentTypeCompressable(ContentType contentType) → bool

Whether or not contentType has been configured to be compressed.

setAllowsCompression(ContentType contentType, bool allowed) → void

Toggles whether HTTP bodies of contentType are compressed with GZIP.

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