Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
backend ruleP1universalStack: HTTP / fetch
httpheadersfetchjson
Set the Content-Type: application/json header on JSON requests
Include the Content-Type: application/json header when sending a JSON body so servers parse it correctly.
PR: hegnar-forum-web · org-mining-3rd-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | fetch(url, { method: 'POST', body: JSON.stringify(data) }); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }); |
Explanation (EN)
Objašnjenje (HR)