Skip to content

Commit 2a3553f

Browse files
committed
fix(tpl): add Content-Type header for ajax deleting
This solves issue that file cannot be deleted if compiled by Go 1.2. In Go 1.2, calling `(*http.Request).ParseForm()` for POST request that has no header `Content-Type` will got an error.
1 parent 30f331b commit 2a3553f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/tpl/frontend/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@
989989

990990
var xhr = new XMLHttpRequest();
991991
xhr.open('POST', url); // will retrieve deleted result into bfcache
992+
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
992993
xhr.addEventListener('load', onLoad);
993994
xhr.send();
994995
e.preventDefault();

0 commit comments

Comments
 (0)