mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 21:52:32 -06:00
WebUI: clean up fetch API usage
The `Content-type` header isn't required since `URLSearchParams` is present. The `method` property is preferred to be always specified for clarity. The `cache: "no-store"` is preferred for most GET requests to avoid caching. PR #21891.
This commit is contained in:
@@ -278,7 +278,7 @@ window.qBittorrent.Misc ??= (() => {
|
||||
|
||||
const downloadFile = async (url, defaultFileName, errorMessage = "QBT_TR(Unable to download file)QBT_TR[CONTEXT=HttpServer]") => {
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
const response = await fetch(url, { method: "GET" });
|
||||
if (!response.ok) {
|
||||
alert(errorMessage);
|
||||
return;
|
||||
|
||||
@@ -64,7 +64,10 @@ window.qBittorrent.pathAutofill ??= (() => {
|
||||
if (partialPath === "")
|
||||
return;
|
||||
|
||||
fetch(`api/v2/app/getDirectoryContent?dirPath=${partialPath}&mode=${mode}`)
|
||||
fetch(`api/v2/app/getDirectoryContent?dirPath=${partialPath}&mode=${mode}`, {
|
||||
method: "GET",
|
||||
cache: "no-store"
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(filesList => { showInputSuggestions(element, filesList); })
|
||||
.catch(error => {});
|
||||
|
||||
Reference in New Issue
Block a user