Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

400 Bad Request #130

Open
quinm0 opened this issue Aug 15, 2024 · 4 comments
Open

400 Bad Request #130

quinm0 opened this issue Aug 15, 2024 · 4 comments

Comments

@quinm0
Copy link

quinm0 commented Aug 15, 2024

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
Copy link
Author

quinm0 commented Aug 15, 2024

I'm back. I set up a non-bun project to test this and it seems like it's something to do with bun not working with the package. I'll see if I can mess with bunjs's default init tsconfig.json and if I find something helpful I'll report back here

@scttcper
Copy link
Owner

I've not had success with bun yet on this one, i did move towards ofetch hoping to make it easier for non-node environments but bun isn't quite there. Adding torrents fails as well.

@DamnCrab
Copy link

DamnCrab commented Dec 7, 2024

I have encountered the same issue. I found this: unjs/ofetch#439" .Is this related to this issue?

@scttcper
Copy link
Owner

@DamnCrab it's either that one or this one oven-sh/bun#14102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants