From 307f85c024c2626813fe98e9804cacb24a6c5c88 Mon Sep 17 00:00:00 2001 From: tuttb Date: Tue, 29 Aug 2023 00:00:55 -0400 Subject: [PATCH] more redirection/cookie related routes --- .../Server/TestServer.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/RestSharp.Tests.Integrated/Server/TestServer.cs b/test/RestSharp.Tests.Integrated/Server/TestServer.cs index c70534964..3fbd90ca1 100644 --- a/test/RestSharp.Tests.Integrated/Server/TestServer.cs +++ b/test/RestSharp.Tests.Integrated/Server/TestServer.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.Logging; using RestSharp.Tests.Integrated.Server.Handlers; using RestSharp.Tests.Shared.Extensions; +using System.Net; // ReSharper disable ConvertClosureToMethodGroup @@ -41,6 +42,11 @@ public HttpServer(ITestOutputHelper? output = null) { // Cookies _app.MapGet("get-cookies", CookieHandlers.HandleCookies); + _app.MapPut("get-cookies", + (HttpContext cxt) => { + // Make sure we get the status code we expect: + return Results.StatusCode(405); + }); _app.MapGet("set-cookies", CookieHandlers.HandleSetCookies); _app.MapGet( @@ -57,6 +63,18 @@ public HttpServer(ITestOutputHelper? output = null) { ctx.Response.Cookies.Append("redirectCookie", "value1"); return Results.Redirect("/get-cookies", permanent: false, preserveMethod: false); }); + _app.MapPost( + "/post/set-cookie-seeother", + (HttpContext ctx) => { + ctx.Response.Cookies.Append("redirectCookie", "seeOtherValue1"); + return new RedirectWithStatusCodeResult((int)HttpStatusCode.SeeOther, "/get-cookies"); + }); + _app.MapPut( + "/put/set-cookie-redirect", + (HttpContext ctx) => { + ctx.Response.Cookies.Append("redirectCookie", "putCookieValue1"); + return Results.Redirect("/get-cookies", permanent: false, preserveMethod: false); + }); // PUT _app.MapPut(