-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add JSON extension methods to request and response #21731
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
Conversation
src/Http/Http.Extensions/src/HttpContextJsonExtensions.Request.cs
Outdated
Show resolved
Hide resolved
src/Http/Http.Extensions/src/HttpContextJsonExtensions.Response.cs
Outdated
Show resolved
Hide resolved
src/Http/Http.Extensions/src/HttpContextJsonExtensions.Request.cs
Outdated
Show resolved
Hide resolved
src/Http/Http.Extensions/src/HttpContextJsonExtensions.Response.cs
Outdated
Show resolved
Hide resolved
src/Http/Http.Extensions/src/HttpContextJsonExtensions.Request.cs
Outdated
Show resolved
Hide resolved
src/Http/Http.Extensions/src/HttpContextJsonExtensions.Request.cs
Outdated
Show resolved
Hide resolved
src/Http/Http.Extensions/src/HttpContextJsonExtensions.Response.cs
Outdated
Show resolved
Hide resolved
|
I've added support for MVC's JsonOptions to use Http.Json's JsonOptions as its base. Does it make sense for SignalR to do the same thing? SignalR's JSON protocol is independent of ASP.NET Core. It can run on the server or the client. |
I'm on the fence, I think customers do want a single way to configure the server defaults. @BrennanConroy and @halter73 any suggestions? |
|
If SignalR did look to JsonOptions as a source of truth, does a client created on a server pick up what the server is configured when serializing its messages as JSON to send to another server? e.g. you're calling SignalR from a server and the server has been configured so that Enum instances are serialized as strings. Does the SignalR client automatically start serializing messages with Enum instances as strings? I think this would be unexpected behavior. |
Maybe just the server? But this brings up more questions about what the HttpClient factory should do or rather, how to make it read these same options. I think we should leave this alone and separate from SignalR and MVC. If MVC happen to use this API then it will get the appropriate options but we shouldn't import these options everywhere. That's my current take until we get more feedback. |
|
Even on the server, I think it should be possible for MVC and SignalR to use different JSON options. |
81efed8 to
c9db22c
Compare
|
🆙 📅 |
|
You might have to use https://github.com/dotnet/aspnetcore/pull/22275/files#diff-157077aa157aa701d4b4a1419f32a298R1 trick to get the ref assembly working. #22323 should fix it for all ref assemblies. |
0a6fe95 to
7da22a5
Compare
|
Hello @JamesNK! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
|
Apologies, while this PR appears ready to be merged, it looks like |
Fixes #17160
MVC uses default JsonSerializerOptions as baseSignalR uses default JsonSerializerOptions as base