From 4e695536a8ccfb18b05c5dda70abca490f1fc5a3 Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Sat, 20 Jul 2019 11:28:29 -0400 Subject: [PATCH] some basic input handling --- Main.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Main.cs b/Main.cs index 8070ee0..98d92fa 100644 --- a/Main.cs +++ b/Main.cs @@ -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 {