Python Diary | Good use for the Http-Accept header?Python Diary | Good use for the Http-Accept header?: "While working on a project which needs to use JSON for AJAX functions, I thought about using the Http-Accept header to return content depending on what the client asks. Most web browsers send this header, and it is usually on the lines of, I accept anything in the XML mimetypes, including HTML. Since headers can be set from jQuery and various client software, I thought... Why not take advantage of this Http-Accept header and build a Django middleware to return the content which is accepted by the client. So far, it only detects and returns JSON, and there is no caching enabled. Keep in mind that this is my very first version of this middleware, which I did test and works as expected."
'via Blog this'