I struggled to POST to a subclass of ChunkedUploadCompleteView
While the jquery .ajax() post seems to form the request perfectly, I could not get the right combination of headers on my fetch post.
I believe this is because the view is expecting a form to be involved because in _post() the request is expected to have request.POST.get('upload_id') to retrieve upload_id
As a result, POSTing to ChunkedUploadCompleteView with fetch did not see the upload_id or md5 in the body of my fetch-based POSTs.
I ended up overriding _post to change how the view found the two variables like this:
I struggled to POST to a subclass of
ChunkedUploadCompleteView
While the jquery
.ajax()
post seems to form the request perfectly, I could not get the right combination of headers on my fetch post.I believe this is because the view is expecting a form to be involved because in
_post()
the request is expected to haverequest.POST.get('upload_id')
to retrieveupload_id
As a result, POSTing to
ChunkedUploadCompleteView
with fetch did not see theupload_id
ormd5
in the body of my fetch-based POSTs.I ended up overriding
_post
to change how the view found the two variables like this:My fetch method on the javascript side looks like this:
This works just fine for posting to
ChunkedUploadView
which does not require accessingrequest.POST
.Here's
.ajax() post
that does supply arequest.POST
Is there a better way to handle getting data to this view using fetch apart from overriding this internal function?