API bug: /renter/files returns "files": null when zero files exist
Created by: mtlynch
BUG REPORT
Stack Trace or error message
N/A
How to reproduce it (as minimally and precisely as possible)
Start siad
Call /renter/files
$ curl -A "Sia-Agent" "localhost:9980/renter/files"
{"files":null}
Expected Behavior
/renter/files
should return {"files":[]}
Actual Behavior
/renter/files
returns {"files":null}
From a client perspective, null
is unexpected. It's more natural for it to return an empty array.
/renter/contracts/
has intuitive behavior for this:
$ curl -A "Sia-Agent" "localhost:9980/renter/contracts"
{"contracts":[]}
Environment
- Sia version: latest master, as of 2018-02-12 (77bc1a0a)
- OS: Ubuntu 16.04