Skip to content

Adding accept header to callsites within SignalR #55271

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 47 commits into from
May 15, 2024

Conversation

MattyLeslie
Copy link
Contributor

@MattyLeslie MattyLeslie commented Apr 22, 2024

Adding accept header to callsites within SignalR

Summary of the changes
As mentioned in #47398, many of the HttpClient call sites within the SignalR library were missing their appropriate accept headers. This change aims to address that issue.

Description
Changes made include:

  1. Adding accept header to NegotiateAsync() within HttpConnection to ensure header is present for negotiation requests.
  2. Adding accept header to SendMessage() within SendUtils for the send requests.
  3. Adding accept header to Poll() within LongPollingTransport for the get request.
  4. Test to ensure first request and subsequent polling requests for LongPollingTransport have the correct accept header
  5. Test to ensure the request for ServerSentEventsTransport has the correct accept header
  6. Test to ensure the negotiate in HttpConnection has the correct accept header.

Fixes #47398 by ensuring the negotiation requests and other HttpClient call sites of SignalR are made with the relevant accept header.

@ghost ghost added the area-signalr Includes: SignalR clients and servers label Apr 22, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Apr 22, 2024
@BrennanConroy
Copy link
Member

Are you actually changing anything, or just kicking the build? If it's kicking the build please stop.
Also, could you please look into adding tests, see

Assert.Equal("text/event-stream", context.Response.ContentType);
as an example.

@BrennanConroy
Copy link
Member

Looks like you're missing negotiate? Otherwise I think that covers all the spots.

@MattyLeslie
Copy link
Contributor Author

Thank you very much for the insight @BrennanConroy. I believe I have completed all the necessary tests.

@MattyLeslie MattyLeslie marked this pull request as ready for review May 7, 2024 15:11
Copy link
Member

@BrennanConroy BrennanConroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some cleanup comments

@MattyLeslie
Copy link
Contributor Author

@BrennanConroy, it seems functional tests from MVC are failing due to httpClient.timeout. Can I assume this is network related ?

@BrennanConroy
Copy link
Member

Ignore it, I'll rerun the tests if I don't have any more comments after reviewing later today.

@BrennanConroy BrennanConroy merged commit 5fcde60 into dotnet:main May 15, 2024
26 checks passed
@BrennanConroy
Copy link
Member

Thanks @MattyLeslie! Sorry for all the nit-picky comments 😄

@MattyLeslie MattyLeslie deleted the SignalR--Missing-Accept-Header branch May 20, 2024 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SignalR: Missing Accept-Header
3 participants