http-toolkit
Version:
Well-documented toolkit for making elegant HTTP requests with JavaScript
148 lines (138 loc) • 5.42 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.MediaType = void 0;
var CHARSET_ATTRIBUTE = 'charset';
var APPLICATION_TYPE = 'application';
var AUDIO_TYPE = 'audio';
var IMAGE_TYPE = 'image';
var TEXT_TYPE = 'text';
var VIDEO_TYPE = 'video';
var WILDCARD = '*';
var createConstant = function createConstant(type, subType) {
return "".concat(type, "/").concat(subType);
};
var createTextType = function createTextType(subType) {
return createConstant(TEXT_TYPE, subType);
};
var createImageType = function createImageType(subType) {
return createConstant(IMAGE_TYPE, subType);
};
var createAudioType = function createAudioType(subType) {
return createConstant(AUDIO_TYPE, subType);
};
var createVideoType = function createVideoType(subType) {
return createConstant(VIDEO_TYPE, subType);
};
var createApplicationType = function createApplicationType(subType) {
return createConstant(APPLICATION_TYPE, subType);
};
/**
* @module MediaType
* @category Models and Constants
*/
/**
* Common Http Media Types
* @readonly
* @example MediaType.JSON = 'application/json'
* @property {string} JSON 'application/json'
* @property {string} PLAIN_TEXT 'text/plain'
* @property {string} JPEG 'image/jpeg'
* @property {string} ZIP 'application/zip'
* @property {string} MP4_VIDEO 'video/mp4'
* @property {string} MP4_AUDIO 'audio/mp4'
* @property - and many more.
*/
var MediaType = {
ANY_TYPE: createConstant(WILDCARD, WILDCARD),
ANY_TEXT_TYPE: createTextType(WILDCARD),
ANY_IMAGE_TYPE: createImageType(WILDCARD),
ANY_AUDIO_TYPE: createAudioType(WILDCARD),
ANY_VIDEO_TYPE: createVideoType(WILDCARD),
ANY_APPLICATION_TYPE: createApplicationType(WILDCARD),
CACHE_MANIFEST: createTextType('cache-manifest'),
CSS: createTextType('css'),
CSV: createTextType('csv'),
HTML: createTextType('html'),
I_CALENDAR: createTextType('calendar'),
PLAIN_TEXT: createTextType('plain'),
TEXT_JAVASCRIPT: createTextType('javascript'),
TSV: createTextType('tab-separated-values'),
VCARD: createTextType('vcard'),
WML: createTextType('vnd.wap.wml'),
XML: createTextType('xml'),
VTT: createTextType('vtt'),
BMP: createImageType('bmp'),
CRW: createImageType('x-canon-crw'),
GIF: createImageType('gif'),
ICO: createImageType('vnd.microsoft.icon'),
JPEG: createImageType('jpeg'),
PNG: createImageType('png'),
PSD: createImageType('vnd.adobe.photoshop'),
SVG: createImageType('svg+xml'),
TIFF: createImageType('tiff'),
WEBP: createImageType('webp'),
MP4_AUDIO: createAudioType('mp4'),
MPEG_AUDIO: createAudioType('mpeg'),
OGG_AUDIO: createAudioType('ogg'),
WEBM_AUDIO: createAudioType('webm'),
L24_AUDIO: createAudioType('l24'),
BASIC_AUDIO: createAudioType('basic'),
AAC_AUDIO: createAudioType('aac'),
VORBIS_AUDIO: createAudioType('vorbis'),
WMA_AUDIO: createAudioType('x-ms-wma'),
WAX_AUDIO: createAudioType('x-ms-wax'),
VND_REAL_AUDIO: createAudioType('vnd.rn-realaudio'),
VND_WAVE_AUDIO: createAudioType('vnd.wave'),
MP4_VIDEO: createVideoType('mp4'),
MPEG_VIDEO: createVideoType('mpeg'),
OGG_VIDEO: createVideoType('ogg'),
QUICKTIME: createVideoType('quicktime'),
WEBM_VIDEO: createVideoType('webm'),
WMV: createVideoType('x-ms-wmv'),
FLV_VIDEO: createVideoType('x-flv'),
THREE_GPP_VIDEO: createVideoType('3gpp'),
THREE_GPP2_VIDEO: createVideoType('3gpp2'),
APPLICATION_XML: createApplicationType('xml'),
ATOM: createApplicationType('atom+xml'),
BZIP2: createApplicationType('x-bzip2'),
DART: createApplicationType('dart'),
APPLE_PASSBOOK: createApplicationType('vnd.apple.pkpass'),
EOT: createApplicationType('vnd.ms-fontobject'),
EPUB: createApplicationType('epub+zip'),
FORM_DATA: createApplicationType('x-www-form-urlencoded'),
KEY_ARCHIVE: createApplicationType('pkcs12'),
APPLICATION_BINARY: createApplicationType('binary'),
GZIP: createApplicationType('x-gzip'),
JAVASCRIPT: createApplicationType('javascript'),
JSON: createApplicationType('json'),
MANIFEST_JSON: createApplicationType('manifest+json'),
KML: createApplicationType('vnd.google-earth.kml+xml'),
KMZ: createApplicationType('vnd.google-earth.kmz'),
MBOX: createApplicationType('mbox'),
APPLE_MOBILE_CONFIG: createApplicationType('x-apple-aspen-config'),
MICROSOFT_EXCEL: createApplicationType('vnd.ms-excel'),
MICROSOFT_POWERPOINT: createApplicationType('vnd.ms-powerpoint'),
MICROSOFT_WORD: createApplicationType('msword'),
NACL_APPLICATION: createApplicationType('x-nacl'),
NACL_PORTABLE_APPLICATION: createApplicationType('x-pnacl'),
OCTET_STREAM: createApplicationType('octet-stream'),
OGG_CONTAINER: createApplicationType('ogg'),
PDF: createApplicationType('pdf'),
POSTSCRIPT: createApplicationType('postscript'),
PROTOBUF: createApplicationType('protobuf'),
RDF_XML: createApplicationType('rdf+xml'),
RTF: createApplicationType('rtf'),
SFNT: createApplicationType('font-sfnt'),
SHOCKWAVE_FLASH: createApplicationType('x-shockwave-flash'),
SKETCHUP: createApplicationType('vnd.sketchup.skp'),
SOAP_XML: createApplicationType('soap+xml'),
TAR: createApplicationType('x-tar'),
WOFF: createApplicationType('font-woff'),
WOFF2: createApplicationType('font-woff2'),
XHTML: createApplicationType('xhtml+xml'),
XRD: createApplicationType('xrd+xml'),
ZIP: createApplicationType('zip')
};
exports.MediaType = MediaType;
;