Return a JSON error response from file download

If yo prefer to receive a JSON error response when downloading a file then append format=json in the query string.

Written on May 29, 2019