Skip to content

Strawberry Shake WebSocket configuration doesn't have Options field to configure authorization header #6052

Open

Description

Is there an existing issue for this?

  • I have searched the existing issues

Product

Strawberry Shake

Describe the bug

In the Authentication section of the documentation si described that, in order to configure the authentication header for WebSockets, I can use the SetRequestHeader() method under Options

services
    .AddConferenceClient()
    .ConfigureWebSocketClient(client =>
    {
        client.Uri = new Uri("ws://localhost:" + port + "/graphql");
        client.Socket.Options.SetRequestHeader("Authorization", "Bearer ...");
    });

But under client.Socket there is no Options field.

Steps to reproduce

  1. Create a sample .NET 7 Console project.
  2. Import the StrawberryShake.Server and the Microsoft.Extensions.Hosting NuGet packages.
  3. Follow the get started guide until ConferenceClient is created
  4. Try to setup the headers in Program.cs
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
IHost host = Host.CreateDefaultBuilder(args)
    .ConfigureServices((hostContext, services) => {
        services.AddConferenceClient()
            .ConfigureWebSocketClient(client => {
                client.Socket.Options.SetRequestHeader("Authorization", "Bearer ...");
            });
    })
    .Build();

host.Run();

Relevant log output

No response

Additional Context?

No response

Version

13.0.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions