-
Notifications
You must be signed in to change notification settings - Fork 171
rest-server doesn't correctly implement REST API #238
Description
Output of rest-server --version
rest-server version rest-server 0.12.0 compiled with go1.20.3 on linux/amd64
How did you run rest-server exactly?
rest-server --noauth (but this issue is not related to authentication)
curl -X POST localhost:8000/test?create=true to initialize the repo.
curl localhost:8000/index/ or curl -H "Accept:application/vnd.x.restic.rest.v2" localhost:8000/index/; both return null (as the repo is empty)
What backend/server/service did you use to store the repository?
local
Expected behavior
We are running a list directory command on an empty repository.
According to https://restic.readthedocs.io/en/latest/100_references.html#rest-backend, the output should be an empty JSON array, i.e. [].
Actual behavior
see above, output is null.
Steps to reproduce the behavior
see above.
Do you have any idea what may have caused this?
The way rest-server or Go serializes the response doesn't comply to the specification.
Do you have an idea how to solve the issue?
Either change rest-server to comply to the specification (e.g. see rclone which seems to implement the specification correctly) - or change the specification telling that null is also a valid response for an empty array.
Did rest-server help you today? Did it make you happy in any way?
No - today it only gave me trouble with https://github.com/rustic-rs/rustic, which does implement the REST API as specified ;-)