Skip to content

Fix browser cookie tests to only run with HTTPS #39665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,13 @@

using System.Buffers;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Http.Connections;

namespace FunctionalTests;

public class EchoConnectionHandler : ConnectionHandler
{
public override async Task OnConnectedAsync(ConnectionContext connection)
{
var context = connection.GetHttpContext();
// The 'withCredentials' tests wont send a cookie for cross-site requests
if (!context.WebSockets.IsWebSocketRequest && !context.Request.Cookies.ContainsKey("testCookie"))
{
return;
}

while (true)
{
var result = await connection.Transport.Input.ReadAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ describe("connection", () => {

await connection.start(TransferFormat.Text);

await connection.stop();

await closePromise;
});
}
Expand Down
Loading