some basic input handling

This commit is contained in:
Tommy Parnell
2019-07-20 11:28:29 -04:00
parent 50e85b8bd2
commit 4e695536a8

View File

@@ -33,14 +33,15 @@ namespace bundlephobia
var text = httpReq.Form["text"];
var responseUrl = httpReq.Form["response_url"];
if (string.IsNullOrWhiteSpace(text))
{
throw new ArgumentNullException(nameof(text));
}
if (string.IsNullOrWhiteSpace(responseUrl))
{
throw new ArgumentNullException(nameof(text));
}
if (string.IsNullOrWhiteSpace(text))
{
await Client.PostAsJsonAsync(responseUrl, new { text = $"😢 Please type a name of a package with /yikes packageName" });
}
httpReq.HttpContext.Response.Clear();
try
{