fixes #839

correctly set content type to `application/json` when json is returned