Search code examples
djangohttphttp-posthttprequestw3c

Why does Django use uppercase & W3C tends towards lowercase names for HTTP request methods


This Stackoverflow post says: W3C has tended towards lowercase for attribute names and values for a while i.e. use something like

<form method="post" />

However, in a Django view, the method name is compared with an uppercase string

if request.method == 'POST': # If the form has been submitted...

Why are the cases mixed up here ? Is the browser converting 'post' to uppercase for Django?


Solution

  • HTTP method names are case-sensitive, and all registered method names are all-uppercase.

    The lowercase spelling in HTML form attributes essentially is a bug in HTML that is impossible to fix due to backwards compatibility reasons.