Class: MediaType

Describes the nature of the data in the body of a MIME entity.

Methods

getBaseType

Gets the “primaryType/subtype+suffix” combination in a string format.

toString

Converts the media type to a string, which is suitable to be used as the value of a corresponding HTTP header.

Fields

  • primaryType string(default "")
  • Declares the general type of data

  • subType string(default "")
  • A specific format of the primary-type data

  • suffix string(default "")
  • Identifies the semantics of a specific media type

  • parameters map<string>(default {})
  • A set of parameters specified in an attribute=value notation

getBaseType

function getBaseType() returns string
Isolated Function

Gets the “primaryType/subtype+suffix” combination in a string format.

1string baseType = mediaType.getBaseType();

Return Type

(string)

Base type as a string from the MediaType struct

toString

function toString() returns string
Isolated Function

Converts the media type to a string, which is suitable to be used as the value of a corresponding HTTP header.

1string mediaTypeString = mediaType.toString();

Return Type

(string)

Content type with parameters as a string