public ActionResult HitCount(string url, bool pretty = false) { try { string clean = SanitizeUrl(url); int hits = Extender.GetHits(clean); if (pretty) { return(Ok($"The {config.magicWord}-extended version of {url} has been visited {hits} time(s)")); } else { return(Ok(Extender.GetHits(clean))); } } catch (KeyNotFoundException) { return(NotFound($"The provided URL has not yet been {config.magicWord}-extended")); } catch (ArgumentException e) { if (e.Message == "Invalid URL") { return(BadRequest(e.Message)); } else { throw e; } } }