ContentType

View Source

Summary

The value of a Content-Type HTTP header.

MDN Content-Type Reference

HTTP/1.1 Specification

Signature

class ContentType {
  constructor(init: string | ContentTypeInit): ContentType;

  // Properties
  boundary?: string;
  charset?: string;
  mediaType?: string;

  // Methods
  toString(): string;
  from(value: string | ContentTypeInit | null): ContentType;
}

Constructor Params

init

Properties

boundary

Multipart boundary parameter value.

charset

Character set parameter value.

mediaType

Media type such as text/html or application/json.

Methods

toString(): string

Returns the string representation of the header value.

from(value: string | ContentTypeInit | null): ContentType

Parse a Content-Type header value.

value

The header value (string, init object, or null)