Skip to content

Commit 00b718e

Browse files
committed
Added very first of many redirection cookie tests.
1 parent c6b39b5 commit 00b718e

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

test/RestSharp.Tests.Integrated/RedirectTests.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,21 @@ public async Task Can_Perform_GET_Async_With_Request_Cookies() {
5353
response.Content.Should().Be("[\"cookie=value\",\"cookie2=value2\"]");
5454
}
5555

56+
[Fact]
57+
public async Task Can_Perform_POST_Async_With_RedirectionResponse_Cookies() {
58+
var request = new RestRequest("/post/set-cookie-redirect") {
59+
Method = Method.Post,
60+
};
61+
62+
var response = await _client.ExecuteAsync(request);
63+
// Verify the cookie exists from the POST:
64+
response.Cookies.Count.Should().BeGreaterThan(0).And.Be(1);
65+
response.Cookies[0].Name.Should().Be("redirectCookie");
66+
response.Cookies[0].Value.Should().Be("value1");
67+
// Make sure the redirected location spits out the correct content:
68+
response.Content.Should().Be("[\"redirectCookie=value1\"]", "was successfully redirected to get-cookies");
69+
}
70+
5671
class Response {
5772
public string? Message { get; set; }
5873
}

0 commit comments

Comments
 (0)