Content Types
提供了一系列预定义的、标准的 ContentType 实例以及用于创建自定义内容类型的工厂方法。
使用此接口可以以类型安全的方式引用常见的 MIME 类型,避免在代码中使用 "魔术字符串"(hardcoded strings), 从而减少拼写错误并利用 IDE 的自动补全功能。
Author
M8Test, [email protected], https://m8test.com
Functions
通过指定主类型和子类型来创建一个 ContentType 对象。
代表任意内容类型 * / *。
代表任意 application 类型 application / *。
代表 application/atom+xml。
代表 application/cbor。
代表 application/vnd.openxmlformats-officedocument.wordprocessingml.document (Word)。
代表 application/x-www-form-urlencoded,用于网页表单提交。
代表 application/gzip。
代表 application/hal+json。
代表 application/javascript。
代表 application/json。
代表 application/octet-stream,用于通用的二进制数据。
代表 application/pdf。
代表 application/vnd.openxmlformats-officedocument.presentationml.presentation (PowerPoint)。
代表 application/problem+json。
代表 application/problem+xml。
代表 application/protobuf (Protocol Buffers)。
代表 application/rss+xml。
代表 application/soap+xml。
代表 application/wasm (WebAssembly)。
代表 application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (Excel)。
代表 application/xml。
代表 application/xml-dtd。
代表 application/yaml。
代表 application/zip。
代表任意 audio 类型 audio / *。
代表 audio/mp4。
代表 audio/mpeg (MP3)。
代表 audio/ogg。
代表任意 font 类型 font / *。
代表 font/collection。
代表 font/otf。
代表 font/sfnt。
代表 font/ttf。
代表 font/woff。
代表 font/woff2。
代表任意 image 类型 image / *。
代表 image/apng (Animated PNG)。
代表 image/avif。
代表 image/bmp。
代表 image/gif。
代表 image/heic。
代表 image/heif。
代表 image/jpeg。
代表 image/jxl。
代表 image/png。
代表 image/svg+xml。
代表 image/tiff。
代表 image/webp。
代表 image/x-icon (Favicon)。
代表任意 message 类型 message / *。
代表 message/http。
代表 multipart/alternative。
代表任意 multipart 类型 multipart / *。
代表 multipart/byteranges。
代表 multipart/encrypted。
代表 multipart/form-data,用于文件上传和表单。
代表 multipart/mixed。
代表 multipart/related。
代表 multipart/signed。
代表任意 text 类型 text / *。
代表 text/css。
代表 text/csv。
代表 text/event-stream (Server-Sent Events)。
代表 text/html。
代表 text/javascript。
代表 text/plain。
代表 text/vcard。
代表 text/xml。
代表任意 video 类型 video / *。
代表 video/mp4。
代表 video/mpeg。
代表 video/ogg。
代表 video/quicktime。
从一个包含完整内容类型值的字符串中解析出 ContentType 对象。