Use POST with method=PATCH when sending a bot edit

(imported from commit e6ee1631f0b37e66da5979a5fa6e6860d7f4d0b3)
This commit is contained in:
Leo Franchi 2013-10-21 12:55:26 -04:00
parent 13b452ddf8
commit 196706cc64
1 changed files with 4 additions and 1 deletions

View File

@ -182,6 +182,9 @@ $(function () {
var formData = new FormData(); var formData = new FormData();
formData.append('full_name', full_name); formData.append('full_name', full_name);
formData.append('csrfmiddlewaretoken', csrf_token); formData.append('csrfmiddlewaretoken', csrf_token);
// Send a PATCH as a POST in order to work around QtWebkit (Linux/Windows desktop app)
// not supporting PATCH body.
formData.append('method', 'PATCH');
jQuery.each(file_input[0].files, function (i, file) { jQuery.each(file_input[0].files, function (i, file) {
formData.append('file-'+i, file); formData.append('file-'+i, file);
}); });
@ -189,7 +192,7 @@ $(function () {
edit_button.hide(); edit_button.hide();
$.ajax({ $.ajax({
url: '/json/bots/' + encodeURIComponent(email), url: '/json/bots/' + encodeURIComponent(email),
type: 'PATCH', type: 'POST',
data: formData, data: formData,
cache: false, cache: false,
processData: false, processData: false,