Add missing return

libpod df handler missing a return after writing error to client. This
caused a null to be appended to JSON and crashed python decoder.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
This commit is contained in:
Jhon Honce
2021-04-07 13:55:03 -07:00
parent 8c0df1c44a
commit 6cc0dc44ec
2 changed files with 5 additions and 0 deletions

View File

@ -72,6 +72,7 @@ func DiskUsage(w http.ResponseWriter, r *http.Request) {
response, err := ic.SystemDf(r.Context(), options) response, err := ic.SystemDf(r.Context(), options)
if err != nil { if err != nil {
utils.InternalServerError(w, err) utils.InternalServerError(w, err)
return
} }
utils.WriteResponse(w, http.StatusOK, response) utils.WriteResponse(w, http.StatusOK, response)
} }

View File

@ -727,6 +727,10 @@ class TestApi(unittest.TestCase):
start = json.loads(r.text) start = json.loads(r.text)
self.assertGreater(len(start["Errs"]), 0, r.text) self.assertGreater(len(start["Errs"]), 0, r.text)
def test_df(self):
r = requests.get(_url("/system/df"))
self.assertEqual(r.status_code, 200, r.text)
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()