WebServerTask.HttpServer.WritePostResponseAsync C# (CSharp) Method

WritePostResponseAsync() private method

private WritePostResponseAsync ( string request, IOutputStream os ) : System.Threading.Tasks.Task
request string
os IOutputStream
return System.Threading.Tasks.Task
        private async Task WritePostResponseAsync(string request, IOutputStream os)
        {
            bool urlFound = false;
            byte[] bodyArray = null;
            string responseMsg = "";
            //See if the request it matches any of the valid requests urls and create the response message
            switch (request.ToUpper())
            {
                case "/DEVICES/POOLPUMP/OFF":
                    Devices.PoolPumpPinValue = GpioPinValue.Low;
                    bodyArray = Encoding.UTF8.GetBytes("OFF");
                    responseMsg = "OFF";
                    urlFound = true;
                    break;
                case "/DEVICES/POOLPUMP/ON":
                    Devices.PoolPumpPinValue = GpioPinValue.High;
                    bodyArray = Encoding.UTF8.GetBytes("ON");
                    responseMsg = "ON";
                    urlFound = true;
                    break;
                case "/DEVICES/WATERFALLPUMP/OFF":
                    Devices.PoolWaterfallPinValue = GpioPinValue.Low;
                    bodyArray = Encoding.UTF8.GetBytes("OFF");
                    responseMsg = "OFF";
                    urlFound = true;
                    break;
                case "/DEVICES/WATERFALLPUMP/ON":
                    Devices.PoolWaterfallPinValue = GpioPinValue.High;
                    bodyArray = Encoding.UTF8.GetBytes("ON");
                    responseMsg = "ON";
                    urlFound = true;
                    break;
                case "/DEVICES/POOLLIGHTS/OFF":
                    Devices.PoolLightsPinValue = GpioPinValue.Low;
                    bodyArray = Encoding.UTF8.GetBytes("OFF");
                    responseMsg = "OFF";
                    urlFound = true;
                    break;
                case "/DEVICES/POOLLIGHTS/ON":
                    Devices.PoolLightsPinValue = GpioPinValue.High;
                    bodyArray = Encoding.UTF8.GetBytes("ON");
                    responseMsg = "OFF";
                    urlFound = true;
                    break;
                case "/DEVICES/YARDLIGHTS/OFF":
                    Devices.YardLightsPinValue = GpioPinValue.Low;
                    bodyArray = Encoding.UTF8.GetBytes("OFF");
                    responseMsg = "OFF";
                    urlFound = true;
                    break;
                case "/DEVICES/YARDLIGHTS/ON":
                    Devices.YardLightsPinValue = GpioPinValue.High;
                    bodyArray = Encoding.UTF8.GetBytes("ON");
                    responseMsg = "OFF";
                    urlFound = true;
                    break;
                case "/DEVICES/POOLSOLAR/OFF":
                    Devices.PoolSolarValvePinValue = GpioPinValue.Low;
                    bodyArray = Encoding.UTF8.GetBytes("OFF");
                    responseMsg = "OFF";
                    urlFound = true;
                    break;
                case "/DEVICES/POOLSOLAR/ON":
                    Devices.PoolSolarValvePinValue = GpioPinValue.High;
                    bodyArray = Encoding.UTF8.GetBytes("ON");
                    responseMsg = "ON";
                    urlFound = true;
                    break;
                default:
                    bodyArray = Encoding.UTF8.GetBytes("");
                    urlFound = false;
                    break;
            }

            await WriteResponseAsync(request.ToUpper(), responseMsg, urlFound,bodyArray, os);
        }