Files
moby/api/types/types.go
Sebastiaan van Stijn 0e7c8176e8 api/types: add MediaType pseudo-type, and touch-up docs
Add a `MediaType` pseudo-type to help discoverability of mediatypes
we use, and slightly touch up the documentation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-02-24 14:23:34 +01:00

34 lines
1.4 KiB
Go

package types
// MediaType represents an HTTP media type (MIME type) used in API
// Content-Type and Accept headers.
//
// In addition to standard media types (for example, "application/json"),
// this package defines vendor-specific vendor media types for streaming
// endpoints, such as raw TTY streams and multiplexed stdout/stderr streams.
type MediaType = string
const (
// MediaTypeRawStream is a vendor-specific media type for raw TTY streams.
MediaTypeRawStream MediaType = "application/vnd.docker.raw-stream"
// MediaTypeMultiplexedStream is a vendor-specific media type for streams
// where stdin, stdout, and stderr are multiplexed into a single byte stream.
//
// Use stdcopy.StdCopy (https://pkg.go.dev/github.com/moby/moby/api/pkg/stdcopy)
// to demultiplex the stream.
MediaTypeMultiplexedStream MediaType = "application/vnd.docker.multiplexed-stream"
// MediaTypeJSON is the media type for JSON objects.
MediaTypeJSON MediaType = "application/json"
// MediaTypeNDJSON is the media type for newline-delimited JSON streams (https://github.com/ndjson/ndjson-spec).
MediaTypeNDJSON MediaType = "application/x-ndjson"
// MediaTypeJSONLines is the media type for JSON Lines streams (https://jsonlines.org/).
MediaTypeJSONLines MediaType = "application/jsonl"
// MediaTypeJSONSequence is the media type for JSON text sequences (RFC 7464).
MediaTypeJSONSequence MediaType = "application/json-seq"
)