Set the Content-Type to JSON when appropriate; set response code depending on Drush response