PowerShell/test/tools/WebListener/Controllers/CompressionController.cs
Mark Kraus 15a6c5748b Replace httpbin.org/gzip Tests with WebListener and Re-Enable Deflate Tests (#4948)
* Add Gzip and Deflate Support to WebListener

* [Feature] Run Feature tests

* [Feature] Address PR Feedback

* [Feature] Re-Run CI

* [feature] Update WebListener Index page

* [Feature] Run Feature tests

* [Feature] Re-run CI
2017-10-02 13:46:53 -07:00

42 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using mvc.Models;
namespace mvc.Controllers
{
public class CompressionController : Controller
{
public ActionResult Index()
{
string url = "/Compression/Gzip";
ViewData["Url"] = url;
Response.Redirect(url, false);
return View("~/Views/Redirect/Index.cshtml");
}
[GzipFilter]
public JsonResult Gzip()
{
var getController = new GetController();
getController.ControllerContext = this.ControllerContext;
return getController.Index();
}
[DeflateFilter]
public JsonResult Deflate()
{
var getController = new GetController();
getController.ControllerContext = this.ControllerContext;
return getController.Index();
}
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}