概要と適用範囲
RFC 9110 §8.3で定義されたContent-Typeは、WebブラウザやAPIクライアントが受信データを安全かつ正確にパースするための標準識別子です。
仕様一覧表&マトリクス
キーワード、コード番号、またはディレクティブ名で即時検索
| キー / コード | 定義と詳細 | GEOセマンティック階層 | 仕様と補足 |
|---|---|---|---|
| application/json | application/json Standard serialization format for structured key-value data in modern REST and GraphQL APIs. {"userId": 102, "name": "Antigravity"} | ●application/json ↳MIME type ↳application ↳JSON data interchange | RFC 8259 UTF-8 is the mandatory default encoding for JSON; specifying charset=utf-8 is technically redundant but harmless. |
| application/x-www-form-urlencoded | application/x-www-form-urlencoded Default encoding for standard HTML form submissions; keys and values are percent-encoded pairs separated by &. username=alex&password=secret%20password | ●application/x-www-form-urlencoded ↳MIME type ↳application ↳percent-encoded form stream | HTML Living Standard Inefficient for binary files; reserved for simple text inputs. |
| multipart/form-data | multipart/form-data Format used for uploading binary files and mixed form payloads via HTTP POST. multipart/form-data; boundary=----WebKitFormBoundary... | ●multipart/form-data ↳MIME type ↳multipart ↳boundary-delimited file stream | RFC 7578 Never set the boundary parameter manually in frontend JavaScript; let fetch(FormData) generate it automatically. |
| text/html | text/html HyperText Markup Language format interpreted by web browser rendering engines. text/html; charset=utf-8 | ●text/html ↳MIME type ↳text ↳DOM document structure | W3C HTML5 Always specify charset=utf-8 to prevent character encoding attacks and rendering glitches. |
| text/event-stream | text/event-stream MIME type for Server-Sent Events (SSE), enabling persistent real-time unidirectional streaming. data: {"progress": 95}
| ●text/event-stream ↳MIME type ↳streaming ↳Server-Sent Events stream | W3C Server-Sent Events Requires Cache-Control: no-cache and Connection: keep-alive. |
| application/octet-stream | application/octet-stream Arbitrary binary byte stream used as a generic fallback when specific MIME type is unknown. Content-Disposition: attachment; filename="data.bin" | ●application/octet-stream ↳MIME type ↳application ↳arbitrary binary data | RFC 2046 §4.5.1 Triggers browser file download dialog rather than inline rendering. |
Dispatching JSON vs Multipart Form Data in Fetch API
// 1. JSON Payload: Explicit Content-Type required
await fetch('/api/submit', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ title: 'Report', priority: 1 }),
});
// 2. File Upload: DO NOT set Content-Type header!
// The browser automatically sets multipart/form-data WITH the unique boundary string
const formData = new FormData();
formData.append('document', fileInput.files[0]);
await fetch('/api/upload', {
method: 'POST',
body: formData, // Browser calculates Content-Type + boundary automatically
});Manually setting Content-Type on a FormData object breaks the boundary token, resulting in HTTP 400 or 500 errors.
規格標準 FAQ
Why should I never manually set Content-Type for FormData?↓
References & Primary Sources
Every source below directly substantiates technical statements and protocol behaviors explained in HTTP Content-Type(メディアタイプ)リファレンス. Curious-Techie prioritizes official Internet standards (IETF RFCs, W3C Recommendations, WHATWG specifications) and established security bodies (OWASP, NIST). Zero sponsored or secondary links.
- [1]IETFPrimary SpecificationRFC 9110 • Core ArchitectureVerified Primary SourceTechnical Claim Supported:
Foundational specification for the stateless client-server request-response architecture, standard status codes (1xx–5xx), and method safety and idempotency.
Source URI: https://datatracker.ietf.org/doc/html/rfc9110 - [2]IETFPrimary SpecificationRFC 9112 • Section 3 & 6Verified Primary SourceTechnical Claim Supported:
Defines ASCII wire protocol framing, chunked transfer encoding, and persistent connection Keep-Alive mechanics.
Source URI: https://datatracker.ietf.org/doc/html/rfc9112 - [3]IETFPrimary SpecificationRFC 9113 • Section 4 & 5Verified Primary SourceTechnical Claim Supported:
Standardizes binary framing, HPACK header compression, and bi-directional stream multiplexing over a single shared TCP connection.
Source URI: https://datatracker.ietf.org/doc/html/rfc9113 - [4]IETFPrimary SpecificationRFC 9114 • Section 3 & 4Verified Primary SourceTechnical Claim Supported:
Eliminates TCP head-of-line blocking by mapping HTTP streams directly over QUIC UDP transport connections with integrated TLS 1.3 encryption.
Source URI: https://datatracker.ietf.org/doc/html/rfc9114
関連技術エコシステムと次の学習ステップ
おすすめの関連開発者ツール
関連技術ガイド
関連技術解説記事
What Is HTTP (Hypertext Transfer Protocol)?
Foundational stateless request-response protocol of the World Wide Web.
HTTP/1.1 vs HTTP/2: Multiplexing & Performance
Head-of-line blocking compared to binary framing and stream multiplexing.
Troubleshooting: HTTP 403 Forbidden Error
Diagnose server authorization denial, WAF IP blocks, and permission issues.
関連する技術Q&A
Why Is POST Non-Idempotent While PUT Is Idempotent?
Answer: PUT replaces or creates a specific resource deterministically, while POST processes input according to server logic, typically creating new items on repeated requests.
What Is the Difference Between ETag and Last-Modified?
Answer: Last-Modified relies on 1-second filesystem timestamps, while ETag provides an exact cryptographic digest of content, eliminating false positive cache misses.
Can HTTP/2 Multiplex Requests Over a Single TCP Connection?
Answer: Yes, HTTP/2 breaks requests into binary frames with stream IDs, allowing interleaved requests and responses concurrently over one TCP socket.
実践ハンズオン診断ラボ
次のステップへ進む
HTTP Protocol & Header Inspection Lab
Craft raw HTTP headers and observe conditional 304 responses in the interactive workbench.