Skip to content

Request header content-type should be application/x-bittorrent #483

@JanGross

Description

@JanGross

When trying to upload a new torrent, the request gets sent as content-type multipart/form-data and thus the API throws

Request header content-type should be application/x-bittorrent

I tried using both Chrome and Firefox against the demo instance.
Request headers for reference (some parts omitted):

POST /api/v1/torrent/upload HTTP/2
Host: index.torrust-demo.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0
Accept: */*
Accept-Encoding: gzip, deflate, br
Referer: http://index.torrust-demo.com/
Content-Type: multipart/form-data; boundary=---------------------------108118935725644999701078262824
Content-Length: 51548

Request body for reference

-----------------------------108118935725644999701078262824
Content-Disposition: form-data; name="title"

Test Debian
-----------------------------108118935725644999701078262824
Content-Disposition: form-data; name="description"

Test description
-----------------------------108118935725644999701078262824
Content-Disposition: form-data; name="category"

software
-----------------------------108118935725644999701078262824
Content-Disposition: form-data; name="tags"

[1]
-----------------------------108118935725644999701078262824
Content-Disposition: form-data; name="torrent"; filename="debian-12.5.0-amd64-netinst.iso.torrent"
Content-Type: application/octet-stream

d8:announce41:http://bttracker.debian.org:6969/announce7:comment35:"Debian CD from cdimage.debian.org"10:created by13:mktorrent 1.113:creation datei1707570148e4:infod6:lengthi659554304e4:name31:debian-12.5.0-amd64-netinst.iso12:piece lengthi262144e6:pieces50320:[.. remaining binary content]

As a test file I used the amd64 Debian CD ISO .torrent from https://www.debian.org/CD/torrent-cd/

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions