title: 405 Method not allowed when uploading file
body: <p>I have a class-based view with a defined <code>post</code> method, which is the end-point of a file upload.</p>
  
  <p>The request is made using the <code>ng-file-upload</code> module.</p>
  
  <p>When executing the upload request, I receive a <code>405 Method not allowed</code> error.</p>
  
  <p>If I try to make a POST to that same URL with the same parameters (except for the file), it's working fine.</p>
  
  <p>I can see in Firebug that the Response Headers are different:</p>
  
  <ul>
  <li>When sending the request via POST, the response's allowed method are POST and OPTIONS</li>
  <li>When sending via upload, they are GET, HEAD and OPTIONS</li>
  </ul>
  
  <p>What could be causing this?</p>
  
  <p>[edit]
  As requested, here is the (simplified) code of the view handling method:</p>
  
  <pre><code>def order_data(order, request):
      """
      Return a serialized order with added permission information
      """
      data = OrderSerializer(order).data
  
      # Add a few custom fields on the data dict
  
      return data
  
  class SaveOrder(APIView):
  
      def post(self, request):
          data = request.data.get('order')
  
          if data.get('id', None) is not None:
              if not request.user.has_perm('orders.modify_order'):
                  return HttpResponseForbidden()
              else:
                  order = Order.objects.get(id=data['id'])
          else:
              if not request.user.has_perm('orders.create_order'):
                  return HttpResponseForbidden()
              else:
                  order = Order()
  
          # Fill in order using the fields in data
  
           order.save()
  
          return JsonResponse(order_data(order, request))
  </code></pre>
  
  <p>[edit2] Actually the behaviour is not exactly what I've described earlier:</p>
  
  <ul>
  <li>With <code>upload</code> to url <code>/order/save-order</code> I get an error saying that I need a trailing slash</li>
  <li>With <code>upload</code> to url <code>/order/save-order/</code> I get a 405</li>
  <li>With <code>post</code> to url <code>/order/save-order</code> it's working fine (original code)</li>
  <li>With <code>post</code> to url <code>/order/save-order/</code> I get a 404</li>
  </ul>