[{"data":1,"prerenderedAt":326},["ShallowReactive",2],{"term-c\u002Fcontent-type":3,"related-c\u002Fcontent-type":309},{"id":4,"title":5,"acronym":6,"body":7,"category":290,"description":291,"difficulty":292,"extension":293,"letter":294,"meta":295,"navigation":151,"path":296,"related":297,"seo":303,"sitemap":304,"stem":307,"subcategory":6,"__hash__":308},"terms\u002Fterms\u002Fc\u002Fcontent-type.md","Content-Type",null,{"type":8,"value":9,"toc":284},"minimark",[10,15,19,23,26,30,273,277,280],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18],"p",{},"Content-Type is a header that tells the receiver what format the data is in. 'I'm sending you JSON.' 'I'm sending you a PNG image.' 'I'm sending you HTML.' Without it, the receiver has to guess what to do with the blob of bytes it received.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"Content-Type is an HTTP header that indicates the media type (MIME type) of the request or response body. It helps the client or server parse the body correctly. Common values: application\u002Fjson, text\u002Fhtml, multipart\u002Fform-data, application\u002Fx-www-form-urlencoded, image\u002Fpng.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-javascript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F Setting Content-Type in requests\n\u002F\u002F JSON API\nfetch('\u002Fapi', {\n  headers: { 'Content-Type': 'application\u002Fjson' },\n  body: JSON.stringify(data)\n});\n\n\u002F\u002F File upload\nconst form = new FormData();\nform.append('file', fileInput.files[0]);\nfetch('\u002Fupload', { method: 'POST', body: form });\n\u002F\u002F Browser auto-sets Content-Type: multipart\u002Fform-data\n","javascript","",[38,39,40,49,55,82,114,134,146,153,159,183,222,267],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,48],{"class":47},"sHwdD","\u002F\u002F Setting Content-Type in requests\n",[41,50,52],{"class":43,"line":51},2,[41,53,54],{"class":47},"\u002F\u002F JSON API\n",[41,56,58,62,66,70,74,76,79],{"class":43,"line":57},3,[41,59,61],{"class":60},"s2Zo4","fetch",[41,63,65],{"class":64},"sTEyZ","(",[41,67,69],{"class":68},"sMK4o","'",[41,71,73],{"class":72},"sfazB","\u002Fapi",[41,75,69],{"class":68},[41,77,78],{"class":68},",",[41,80,81],{"class":68}," {\n",[41,83,85,89,92,95,98,100,102,104,106,109,111],{"class":43,"line":84},4,[41,86,88],{"class":87},"swJcz","  headers",[41,90,91],{"class":68},":",[41,93,94],{"class":68}," {",[41,96,97],{"class":68}," '",[41,99,5],{"class":87},[41,101,69],{"class":68},[41,103,91],{"class":68},[41,105,97],{"class":68},[41,107,108],{"class":72},"application\u002Fjson",[41,110,69],{"class":68},[41,112,113],{"class":68}," },\n",[41,115,117,120,122,125,128,131],{"class":43,"line":116},5,[41,118,119],{"class":87},"  body",[41,121,91],{"class":68},[41,123,124],{"class":64}," JSON",[41,126,127],{"class":68},".",[41,129,130],{"class":60},"stringify",[41,132,133],{"class":64},"(data)\n",[41,135,137,140,143],{"class":43,"line":136},6,[41,138,139],{"class":68},"}",[41,141,142],{"class":64},")",[41,144,145],{"class":68},";\n",[41,147,149],{"class":43,"line":148},7,[41,150,152],{"emptyLinePlaceholder":151},true,"\n",[41,154,156],{"class":43,"line":155},8,[41,157,158],{"class":47},"\u002F\u002F File upload\n",[41,160,162,166,169,172,175,178,181],{"class":43,"line":161},9,[41,163,165],{"class":164},"spNyl","const",[41,167,168],{"class":64}," form ",[41,170,171],{"class":68},"=",[41,173,174],{"class":68}," new",[41,176,177],{"class":60}," FormData",[41,179,180],{"class":64},"()",[41,182,145],{"class":68},[41,184,186,189,191,194,196,198,201,203,205,208,210,213,217,220],{"class":43,"line":185},10,[41,187,188],{"class":64},"form",[41,190,127],{"class":68},[41,192,193],{"class":60},"append",[41,195,65],{"class":64},[41,197,69],{"class":68},[41,199,200],{"class":72},"file",[41,202,69],{"class":68},[41,204,78],{"class":68},[41,206,207],{"class":64}," fileInput",[41,209,127],{"class":68},[41,211,212],{"class":64},"files[",[41,214,216],{"class":215},"sbssI","0",[41,218,219],{"class":64},"])",[41,221,145],{"class":68},[41,223,225,227,229,231,234,236,238,240,243,245,247,250,252,254,257,259,261,263,265],{"class":43,"line":224},11,[41,226,61],{"class":60},[41,228,65],{"class":64},[41,230,69],{"class":68},[41,232,233],{"class":72},"\u002Fupload",[41,235,69],{"class":68},[41,237,78],{"class":68},[41,239,94],{"class":68},[41,241,242],{"class":87}," method",[41,244,91],{"class":68},[41,246,97],{"class":68},[41,248,249],{"class":72},"POST",[41,251,69],{"class":68},[41,253,78],{"class":68},[41,255,256],{"class":87}," body",[41,258,91],{"class":68},[41,260,168],{"class":64},[41,262,139],{"class":68},[41,264,142],{"class":64},[41,266,145],{"class":68},[41,268,270],{"class":43,"line":269},12,[41,271,272],{"class":47},"\u002F\u002F Browser auto-sets Content-Type: multipart\u002Fform-data\n",[11,274,276],{"id":275},"when-youll-hear-this","When You'll Hear This",[16,278,279],{},"\"Set Content-Type to application\u002Fjson when sending JSON.\" \u002F \"The API rejected the request because Content-Type was missing.\"",[281,282,283],"style",{},"html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":51,"depth":51,"links":285},[286,287,288,289],{"id":13,"depth":51,"text":14},{"id":21,"depth":51,"text":22},{"id":28,"depth":51,"text":29},{"id":275,"depth":51,"text":276},"networking","Content-Type is a header that tells the receiver what format the data is in. 'I'm sending you JSON.' 'I'm sending you a PNG image.' 'I'm sending you HTML.","beginner","md","c",{},"\u002Fterms\u002Fc\u002Fcontent-type",[298,299,300,301,302],"MIME Type","Header","Request","Response","Payload",{"title":5,"description":291},{"changefreq":305,"priority":306},"weekly",0.7,"terms\u002Fc\u002Fcontent-type","grHneXoeygq3JP9SzMQgyJxgaLI3bK6xv2ywvqWPXj0",[310,313,317,320,323],{"title":299,"path":311,"acronym":6,"category":290,"difficulty":292,"description":312},"\u002Fterms\u002Fh\u002Fheader","Headers are the metadata attached to HTTP requests and responses — information about the information.",{"title":298,"path":314,"acronym":315,"category":290,"difficulty":292,"description":316},"\u002Fterms\u002Fm\u002Fmime-type","Multipurpose Internet Mail Extensions Type","A MIME type is a standardized label for what type of content something is. 'text\u002Fhtml' means HTML. 'image\u002Fjpeg' means a JPEG image.",{"title":302,"path":318,"acronym":6,"category":290,"difficulty":292,"description":319},"\u002Fterms\u002Fp\u002Fpayload","Payload is the actual data carried in a request or response — the valuable cargo.",{"title":300,"path":321,"acronym":6,"category":290,"difficulty":292,"description":322},"\u002Fterms\u002Fr\u002Frequest","A request is what your browser (or app) sends to a server when it wants something. 'Give me the homepage.' 'Give me that image.",{"title":301,"path":324,"acronym":6,"category":290,"difficulty":292,"description":325},"\u002Fterms\u002Fr\u002Fresponse","A response is what the server sends back after receiving a request.",1776518269453]