Wrong Content-Type in HTTP API?

What is the problem you are having with rclone?

Is it intended that the HTTP API always returns the Content-Type text/plain; charset=utf-8 instead of application/json although the response body contains JSON data?

It does not matter if rclone runs under Linux (Docker) or Windows.

The VSCode REST Client for example cannot handle the response properly when the Content-Type does not match:

Only JSON and XML response/request body is supported to query the result

Is it possible to change/customize the Content-Type?

Run the command 'rclone version' and share the full output of the command.

rclone v1.66.0
- os/version: alpine 3.19.1 (64 bit)
- os/kernel: 5.15.0-101-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.22.1
- go/linking: static
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Does not seem to be relevant

The command you were trying to run (eg rclone copy /tmp remote:tmp)

curl -v -X POST http://localhost:5572/core/stats

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

type = smb
host = XXX
user = XXX
pass = XXX
### Double check the config for sensitive info before posting publicly

Also not relevant from my oint of view.

A log from the command that you were trying to run with the -vv flag

rclone    | 2024/04/03 22:49:45 DEBUG : rclone: Version "v1.66.0" starting with parameters ["rclone" "rcd" "--rc-addr" ":5572" "--rc-no-auth" "-vv"]
rclone    | 2024/04/03 22:49:45 NOTICE: Serving remote control on http://[::]:5572/
rclone    | 2024/04/03 22:49:56 DEBUG : rc: "core/stats": with parameters map[]
rclone    | 2024/04/03 22:49:56 DEBUG : rc: "core/stats": reply map[bytes:0 checks:0 deletedDirs:0 deletes:0 elapsedTime:10.985591033 errors:0 eta:<nil> fatalError:false renames:0 retryError:false serverSideCopies:0 serverSideCopyBytes:0 serverSideMoveBytes:0 serverSideMoves:0 speed:0 totalBytes:0 totalChecks:0 totalTransfers:0 transferTime:0 transfers:0]: <nil>

I think that is an oversight.

I think it would be easy to fix though. Can you maker an issue on GitHub about it? Or maybe you'd like to send a PR?

I don't think my programming skills are sufficient to create a PR.

Here is the issue: Wrong Content-Type in HTTP API · Issue #7726 · rclone/rclone · GitHub

Thank you in advance

1 Like

Fixed in #7730
Thank you

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.