What does “Content-type: application/json; charset=utf-8” really mean?

When I make a POST request with a JSON body to my REST service I include Content-type: application/json; charset=utf-8 in the message header. Without this header, I get an error from the service. I can also successfully use Content-type: application/json without the ;charset=utf-8 portion. What exactly does charset=utf-8 do ? I know it specifies the … Read more

Stylesheet not loaded because of MIME-type

I’m working on a website that uses gulp to compile and browser sync to keep the browser synchronised with my changes. The gulp task compiles everything properly, but on the website, I’m unable to see any style, and the console shows this error message: Refused to apply style from ‘http://localhost:3000/assets/styles/custom-style.css’ because its MIME type (‘text/html’) … Read more

What is a correct MIME type for .docx, .pptx, etc.?

For older *.doc documents, this was enough: header(“Content-Type: application/msword”); What MIME type should I use for new .docx documents? Also, for pptx and xlsx documents? 9 Here are the correct Microsoft Office MIME types for HTTP content streaming: Extension MIME Type .doc application/msword .dot application/msword .docx application/vnd.openxmlformats-officedocument.wordprocessingml.document .dotx application/vnd.openxmlformats-officedocument.wordprocessingml.template .docm application/vnd.ms-word.document.macroEnabled.12 .dotm application/vnd.ms-word.template.macroEnabled.12 .xls application/vnd.ms-excel … Read more

What is the correct JSON content type?

I’ve been messing around with JSON for some time, just pushing it out as text and it hasn’t hurt anybody (that I know of), but I’d like to start doing things properly. I have seen so many purported “standards” for the JSON content type: application/json application/x-javascript text/javascript text/x-javascript text/x-json But which one is correct, or … Read more