2.5. HTTP Methods

  • GET

  • POST

  • PUT

  • PATCH

  • DELETE

  • HEAD

  • OPTIONS

  • TRACE

2.5.1. GET vs POST

  • ?argument1=value&argument2=value

  • single argument

  • multiple arguments

  • arrays

  • files

  • multipart

  • security

2.5.2. POST vs. PUT

2.5.3. POST and CSRF

  • csrf_token

2.5.4. PATCH?!

2.5.5. OPTIONS and CORS

http_method_names = ['get', 'post', 'options']

def options(self, request, *args, **kwargs):
    response = HttpResponse(status=200)
    response['Access-Control-Allow-Origin'] = '*'
    response['Access-Control-Allow-Methods'] = ', '.join(http_method_names).upper()
    response['Access-Control-Allow-Headers'] = 'Content-Type'
    return response