qbittorrent icon indicating copy to clipboard operation
qbittorrent copied to clipboard

400 Bad Request

Open quinm0 opened this issue 6 months ago • 2 comments

I am using Bun(1.1.8) to run this so maybe that's something. I'm getting an invalid request error when trying to use any non GET request from the library. I like to assume Bun isn't causing this issue, but I'll check that out next

But basically when I run this code

const client = new QBittorrent({
  baseUrl: "http://HOSTNAME:PORT/",
  username: "admin",
  password: "password",
});

const torrents = await client.listTorrents();
await Promise.all(
  torrents.map(async (torrent) => {
    console.log("Pausing", torrent.name, torrent.hash);
    return await client.removeTorrent("all");
  })
);

console.log("Hello via Bun!");
Pausing ubuntu-24.04-desktop-amd64.iso 2aa4f5a7e209e54b32803d43670971c4c8caaa05
Pausing ubuntu-22.04.4-desktop-amd64.iso 018e50b58106b84a42c223ccf0494334f8d55958
FetchError: [POST] "http://HOSTNAME:PORT/api/v2/torrents/delete": 400 Bad Request
FetchError: [POST] "http://HOSTNAME:PORT/api/v2/torrents/delete": 400 Bad Request

quinm0 avatar Aug 15 '24 12:08 quinm0